private void save() {
    try {
      Record records[] = listGrid.getRecords();

      Integer mainIdList[] = new Integer[records.length];
      int i = 0;
      for (Record record : records) {
        mainIdList[i++] = record.getAttributeAsInt("main_id");
      }
      DataSource dataSource = DataSource.get("OrgDS");
      com.smartgwt.client.rpc.RPCManager.startQueue();
      Record record = new Record();
      record.setAttribute("mainIdList", mainIdList);
      record.setAttribute(
          "loggedUserName", CommonSingleton.getInstance().getSessionPerson().getUserName());
      DSRequest req = new DSRequest();
      req.setAttribute("operationId", "updateMainServiceOrders");
      dataSource.updateData(
          record,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {
              destroy();
              tabOrganization.search();
            }
          },
          req);
      com.smartgwt.client.rpc.RPCManager.sendQueue();

    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
Ejemplo n.º 2
0
  private void delete(ListGridRecord listGridRecord) {
    try {
      com.smartgwt.client.rpc.RPCManager.startQueue();

      Record record = new Record();
      record.setAttribute(
          "loggedUserName", CommonSingleton.getInstance().getSessionPerson().getUser_name());
      record.setAttribute(
          "billing_company_id", listGridRecord.getAttributeAsInt("billing_company_id"));

      DSRequest req = new DSRequest();
      req.setAttribute("operationId", "removeBillingComp");

      billingCompsGrid.removeData(
          record,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          req);
      com.smartgwt.client.rpc.RPCManager.sendQueue();
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Ejemplo n.º 3
0
  private void search() {
    try {
      String firstname = firstNameItem.getValueAsString();
      String lastname = lastNameItem.getValueAsString();
      String phone = phoneItem.getValueAsString();
      String street_id_str = streetItem.getValueAsString();
      String city_id_str = citiesItem.getValueAsString();
      String city_region_id_str = regionItem.getValueAsString();

      if ((firstname == null || firstname.trim().equals(""))
          && (lastname == null || lastname.trim().equals(""))
          && (phone == null || phone.trim().equals(""))
          && (street_id_str == null || street_id_str.trim().equals(""))) {
        SC.say(CallCenter.constants.warning(), CallCenter.constants.enterAbonentSearchParam());
        return;
      }
      Criteria criteria = new Criteria();
      if (firstname != null && !firstname.trim().equals("")) {
        criteria.setAttribute("firstname_param", firstname);
      }
      if (lastname != null && !lastname.trim().equals("")) {
        criteria.setAttribute("lastname_param", lastname);
      }
      if (phone != null && !phone.trim().equals("")) {
        criteria.setAttribute("phone_param", phone);
      }
      if (street_id_str != null && !street_id_str.trim().equals("")) {
        String tmp = street_id_str.trim();
        String arrStr[] = tmp.split(" ");
        int i = 1;
        for (String string : arrStr) {
          String item = string.trim();
          criteria.setAttribute("street_name_geo_param" + i, item);
          i++;
        }
      }
      if (city_id_str != null && !city_id_str.trim().equals("")) {
        criteria.setAttribute("city_id", new Integer(city_id_str));
      }
      if (city_region_id_str != null && !city_region_id_str.trim().equals("")) {
        criteria.setAttribute("city_region_id", new Integer(city_region_id_str));
      }
      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "customSearchForCC");
      listGrid.invalidateCache();
      listGrid.fetchData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);

    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
Ejemplo n.º 4
0
  private void search() {
    try {

      String calendar_state_id = calendarStateItem.getValueAsString();
      Criteria criteria = new Criteria();
      if (calendar_state_id != null && !calendar_state_id.trim().equals("")) {
        criteria.setAttribute("calendar_state_id", new Integer(calendar_state_id));
      }
      String calendar_event_id = secCalendarTypeItem.getValueAsString();
      if (calendar_event_id != null && !calendar_event_id.trim().equals("")) {
        criteria.setAttribute("calendar_event_id", new Integer(calendar_event_id));
      }
      boolean checkedDate = byCalendarDayItem.getValueAsBoolean();
      if (checkedDate) {
        Date calendar_day = calendarDayItem.getValueAsDate();
        if (calendar_day != null) {
          criteria.setAttribute("calendar_day", calendar_day);
        }
      }
      String calendar_description = descriptionItem.getValueAsString();
      if (calendar_description != null && !calendar_description.trim().equals("")) {
        criteria.setAttribute("calendar_description", calendar_description);
      }
      String calendar_comment = commentItem.getValueAsString();
      if (calendar_comment != null && !calendar_comment.trim().equals("")) {
        criteria.setAttribute("calendar_comment", calendar_comment);
      }

      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "searchAllSecularCalendars");
      listGrid.invalidateCache();
      listGrid.filterData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Ejemplo n.º 5
0
  private void search() {
    try {
      Criteria criteria = new Criteria();
      String billing_company_name = billingCompNameItem.getValueAsString();
      criteria.setAttribute("billing_company_name", billing_company_name);

      String phoneIndex = phoneIndexItem.getValueAsString();

      if (phoneIndex != null && !phoneIndex.equals("")) {

        try {
          new Long(phoneIndex);
        } catch (Exception e) {
          SC.say(CallCenterBK.constants.invalidPhone());
          return;
        }

        criteria.setAttribute("phoneIndex", new Integer(phoneIndex));
      }

      String has_calculation_str = hasCalcItem.getValueAsString();
      if (has_calculation_str != null && !has_calculation_str.equals("-1")) {
        criteria.setAttribute("has_calculation", Integer.parseInt(has_calculation_str));
      }
      Integer operator_src = Integer.parseInt(operatorItem.getValueAsString());
      criteria.setAttribute("operator_src", operator_src);

      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "searchAllBillingComps");
      billingCompsGrid.invalidateCache();
      billingCompsGrid.filterData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Ejemplo n.º 6
0
  private void changeStatus(Integer calendar_id, Integer deleted) {
    try {
      com.smartgwt.client.rpc.RPCManager.startQueue();
      Record record = new Record();
      record.setAttribute("deleted", deleted);
      record.setAttribute("calendar_id", calendar_id);
      record.setAttribute(
          "loggedUserName", CommonSingleton.getInstance().getSessionPerson().getUserName());
      DSRequest req = new DSRequest();

      req.setAttribute("operationId", "updateSecularCalendarStatus");
      listGrid.updateData(
          record,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          req);
      com.smartgwt.client.rpc.RPCManager.sendQueue();
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Ejemplo n.º 7
0
  private void saveCountry() {
    try {
      String cityNameGeo = cityNameGeoItem.getValueAsString();
      if (cityNameGeo == null || cityNameGeo.trim().equalsIgnoreCase("")) {
        SC.say("შეიყვანეთ ქართული დასახელება !");
        return;
      }

      String town_code = cityCodeItem.getValueAsString();
      //			if (town_code == null || town_code.trim().equalsIgnoreCase("")) {
      //				SC.say("შეიყვანეთ ქალაქის კოდი !");
      //				return;
      //			}
      String town_code_new = cityNewCodeItem.getValueAsString();

      ListGridRecord country_record = countryItem.getSelectedRecord();
      if (country_record == null || country_record.getAttributeAsInt("country_id") == null) {
        SC.say("გთხოვთ აირჩიოთ ქვეყანა !");
        return;
      }
      Integer country_id = country_record.getAttributeAsInt("country_id");

      if (cityNameGeo.length() > 1005) {
        SC.say("ქართული დასახელება შედგება მაქსიმუმ 155 სიმბოლოსაგან !");
        return;
      }
      //			if (town_code.length() > 180) {
      //				SC.say("ქალაქის კოდი შედგება მაქსიმუმ 90 სიმბოლოსაგან !");
      //				return;
      //			}
      //			if (town_code_new != null && town_code_new.length() > 180) {
      //				SC.say("ქალაქის ახალი კოდი შედგება მაქსიმუმ 90 სიმბოლოსაგან !");
      //				return;
      //			}

      ListGridRecord city_type_record = townTypeItem.getSelectedRecord();
      if (city_type_record == null
          || city_type_record.getAttributeAsInt("description_id") == null) {
        SC.say("გთხოვთ აირჩიოთ ქალაქის ტიპი !");
        return;
      }
      Integer town_type_id = city_type_record.getAttributeAsInt("description_id");

      String capital_town_record = isCapitalItem.getValueAsString();
      if (capital_town_record == null || capital_town_record.trim().equals("")) {
        SC.say("გთხოვთ აირჩიოთ ქალაქის სახეობა !");
        return;
      }
      Integer capital_town = Integer.parseInt(capital_town_record);

      //			try {
      //				Integer.parseInt(town_code);
      //			} catch (NumberFormatException e) {
      //				SC.say("ქალაქის კოდის შედგება მხოლოდ ციფრებისაგან !");
      //				return;
      //			}
      //			if (town_code_new != null && !town_code_new.equals("")) {
      //				try {
      //					Integer.parseInt(town_code_new);
      //				} catch (NumberFormatException e) {
      //					SC.say("ქალაქის ახალი კოდის შედგება მხოლოდ ციფრებისაგან !");
      //					return;
      //				}
      //			}
      String normal_gmt = ofGmtItem.getValueAsString();
      if (normal_gmt == null || normal_gmt.trim().equals("")) {
        SC.say("გთხოვთ შეიყვანოთ დრო !");
        return;
      }
      try {
        Integer.parseInt(normal_gmt);
      } catch (NumberFormatException e) {
        SC.say("დრო შედგება მხოლოდ ციფრებისაგან !");
        return;
      }
      String winter_gmt = ofGmtWinterItem.getValueAsString();
      if (winter_gmt == null || winter_gmt.trim().equals("")) {
        SC.say("გთხოვთ შეიყვანოთ ზამთრის დრო !");
        return;
      }
      try {
        Integer.parseInt(winter_gmt);
      } catch (NumberFormatException e) {
        SC.say("ზამთრის დრო შედგება მხოლოდ ციფრებისაგან !");
        return;
      }

      com.smartgwt.client.rpc.RPCManager.startQueue();
      Record record = new Record();
      record.setAttribute("town_name", cityNameGeo);
      record.setAttribute("town_code", town_code);
      record.setAttribute("town_new_code", town_code_new);
      record.setAttribute("country_id", country_id);
      record.setAttribute("town_type_id", town_type_id);
      record.setAttribute("capital_town", capital_town);
      record.setAttribute("normal_gmt", normal_gmt);
      record.setAttribute("winter_gmt", winter_gmt);

      if (lCityRecord != null) {
        record.setAttribute("town_id", lCityRecord.getAttributeAsInt("town_id"));
      }
      record.setAttribute(
          "loggedUserName", CommonSingleton.getInstance().getSessionPerson().getUser_name());
      DSRequest req = new DSRequest();

      if (lCityRecord == null) {
        req.setAttribute("operationId", "townAdd");
        cityGrid.addData(
            record,
            new DSCallback() {
              @Override
              public void execute(DSResponse response, Object rawData, DSRequest request) {
                destroy();
              }
            },
            req);
      } else {
        req.setAttribute("operationId", "townUpdate");
        cityGrid.updateData(
            record,
            new DSCallback() {
              @Override
              public void execute(DSResponse response, Object rawData, DSRequest request) {
                destroy();
              }
            },
            req);
      }
      com.smartgwt.client.rpc.RPCManager.sendQueue();
    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }