Example #1
0
        public R2CoreTransportationAndLoadNotificationStandardLoadCapacitorLoadStructure WcGetNSS(bool YourDirty)
        {
            try
            {
                var InstanceLogin = new ATISWebMClassLoginManager();
                var InstanceTransportCompanies = new R2CoreTransportationAndLoadNotificationInstanceTransportCompaniesManager();
                var InstanceAnnouncementHalls  = new R2CoreTransportationAndLoadNotificationInstanceAnnouncementHallsManager();
                if (YourDirty)
                {
                    if (!(TxtnEstelamId.Text == string.Empty | TxtnEstelamId.Text == "0"))
                    {
                        throw new DataEntryException("از کلید ویرایش بار استفاده کنید");
                    }
                }
                else
                {
                    if (TxtnEstelamId.Text == string.Empty | TxtnEstelamId.Text == "0")
                    {
                        throw new DataEntryException("از کلید ثبت بار استفاده کنید");
                    }
                }

                if (TxtSearchLoad.Text == string.Empty)
                {
                    throw new DataEntryException("نوع بار انتخاب نشده است");
                }
                if (TxtSearchTargetCity.Text == string.Empty)
                {
                    throw new DataEntryException("مقصد انتخاب نشده است");
                }
                if (TxtSearchLoaderType.Text == string.Empty)
                {
                    throw new DataEntryException("بارگیر انتخاب نشده است");
                }
                if (TxtnCarNumKol.Text == string.Empty)
                {
                    throw new DataEntryException("تعداد بار نادرست است");
                }
                if (TxtTarrif.Text == string.Empty)
                {
                    TxtTarrif.Text = "0";
                }
                R2CoreTransportationAndLoadNotificationStandardLoadCapacitorLoadStructure NSS = null;
                if (TxtnEstelamId.Text != "0" & TxtnEstelamId.Text != string.Empty)
                {
                    NSS = new R2CoreTransportationAndLoadNotificationStandardLoadCapacitorLoadStructure(Convert.ToInt64(TxtnEstelamId.Text), string.Empty, TxtLoadReciever.Text, Convert.ToInt64(TxtSearchTargetCity.Text.Split('#')[0]), Convert.ToInt64(TxtSearchLoad.Text.Split('#')[0]), InstanceTransportCompanies.GetNSSTransportCompnay(InstanceLogin.GetNSSCurrentUser()).TCId, false, Convert.ToInt64(TxtSearchLoaderType.Text.Split('#')[0]), TxtAddress.Text, InstanceLogin.GetNSSCurrentUser().UserId, Convert.ToInt64(TxtnCarNumKol.Text), Convert.ToInt64(TxtTarrif.Text.Replace(",", "")), TxtDescription.Text, _DateTime.GetCurrentDateShamsiFull(), _DateTime.GetCurrentTime(), Convert.ToInt64(TxtnCarNumKol.Text), R2CoreTransportationAndLoadNotificationLoadCapacitorLoadStatuses.Registered, 21310000, InstanceAnnouncementHalls.GetNSSAnnouncementHallByLoaderTypeId(Convert.ToInt64(TxtSearchLoaderType.Text.Split('#')[0])).AHId, InstanceAnnouncementHalls.GetNSSAnnouncementHallSubGroupByLoaderTypeId(Convert.ToInt64(TxtSearchLoaderType.Text.Split('#')[0])).AHSGId);
                }
                else
                {
                    NSS = new R2CoreTransportationAndLoadNotificationStandardLoadCapacitorLoadStructure(0, string.Empty, TxtLoadReciever.Text, Convert.ToInt64(TxtSearchTargetCity.Text.Split('#')[0]), Convert.ToInt64(TxtSearchLoad.Text.Split('#')[0]), InstanceTransportCompanies.GetNSSTransportCompnay(InstanceLogin.GetNSSCurrentUser()).TCId, false, Convert.ToInt64(TxtSearchLoaderType.Text.Split('#')[0]), TxtAddress.Text, InstanceLogin.GetNSSCurrentUser().UserId, Convert.ToInt64(TxtnCarNumKol.Text), Convert.ToInt64(TxtTarrif.Text.Replace(",", "")), TxtDescription.Text, _DateTime.GetCurrentDateShamsiFull(), _DateTime.GetCurrentTime(), Convert.ToInt64(TxtnCarNumKol.Text), R2CoreTransportationAndLoadNotificationLoadCapacitorLoadStatuses.Registered, 21310000, InstanceAnnouncementHalls.GetNSSAnnouncementHallByLoaderTypeId(Convert.ToInt64(TxtSearchLoaderType.Text.Split('#')[0])).AHId, InstanceAnnouncementHalls.GetNSSAnnouncementHallSubGroupByLoaderTypeId(Convert.ToInt64(TxtSearchLoaderType.Text.Split('#')[0])).AHSGId);
                }
                return(NSS);
            }
            catch (PleaseReloginException ex)
            { Response.Redirect("/LoginManagement/Wflogin.aspx"); return(null); }
            catch (DataEntryException ex)
            { throw ex; }
            catch (Exception ex)
            { throw new Exception(MethodBase.GetCurrentMethod().ReflectedType.FullName + "\\n" + MethodBase.GetCurrentMethod().Name + "\\n" + ex.Message); }
        }
        public HttpResponseMessage GetAnnouncementHallsAnnouncementhAllSubGroupsJOINT()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

            try
            {
                //تایید اعتبار کلاینت
                WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientAnnouncementHallSubGroupsRequest);

                var InstanceAnnouncementHalls = new R2CoreTransportationAndLoadNotificationInstanceAnnouncementHallsManager();
                var Lst     = InstanceAnnouncementHalls.GetAnnouncementHallsAnnouncementHallSubGroupsJOINT();
                var LstPair = new List <KeyValuePair <string, string> >();
                for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++)
                {
                    LstPair.Add(new KeyValuePair <string, string>(Lst[Loopx].NSSAnnouncementHallSubGroup.AHSGId.ToString(), Lst[Loopx].NSSAnnouncementHallSubGroup.AHSGTitle));
                }

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(LstPair), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }