예제 #1
0
        protected void Button1Click(object sender, DirectEventArgs e)
        {
            SpacialDataSet sd = new SpacialDataSet();

            sd.vehicule   = vehicule.Text;
            sd.dateDepart = DateTime.Parse(dateDepart.Text) + TimeSpan.Parse(HD.Text);
            sd.dateArivee = DateTime.Parse(dateArivee.Text) + TimeSpan.Parse(HA.Text);
            if (pm.Checked == true)
            {
                SqlGeometry sqlG = SqlGeometry.Parse(trajet.Text);
                sd.trajet = DbGeometry.FromBinary(sqlG.STAsBinary().Buffer);
            }
            else if (pm.Checked == false)
            {
                SqlGeometry sqlG = SqlGeometry.Parse(trajet.Text);
                sd.trajet = DbGeometry.FromBinary(sqlG.STAsBinary().Buffer);
            }
            sd.active = (bool?)SqlBoolean.Parse(active.Text);
            db        = new demoDB();
            db.SpacialDataSets.Add(sd);
            db.SaveChanges();
            X.Msg.Alert("INFO", "l'opération a été effectuée avec succès").Show();
            ResetInputs();
            Store1.Reload();
            X.Call("resetMap");
        }
예제 #2
0
        protected void SavePattern(object sender, DirectEventArgs e)
        {
            string          day = e.ExtraParams["pattern"];
            SchedulePattern b   = JSON.Deserialize <SchedulePattern>(day);

            b.scId = Convert.ToInt32(CurrentSchedule.Text);
            PostRequest <SchedulePattern> request = new PostRequest <SchedulePattern>();

            request.entity = b;
            PostResponse <SchedulePattern> response = _branchService.ChildAddOrUpdate <SchedulePattern>(request);

            if (!response.Success)//it maybe another check
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.ErrorUpdatingRecord, GetGlobalResourceObject("Errors", response.ErrorCode) != null ? GetGlobalResourceObject("Errors", response.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + response.LogId : response.Summary).Show();
                return;
            }
            else
            {
                Store1.Reload();
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.PatternAppliedSucc
                });
                this.patternWindow.Close();
            }
        }
예제 #3
0
파일: RT107.aspx.cs 프로젝트: EliasTous/ERP
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest && !IsPostBack)
            {
                try
                {
                    AccessControlApplier.ApplyAccessControlOnPage(typeof(Model.Reports.RT107), null, null, null, null);
                }
                catch (AccessDeniedException exp)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied).Show();
                    Viewport1.Hidden = true;
                    return;
                }

                SetExtLanguage();
                HideShowButtons();

                List <Model.System.XMLDictionary> activeStatusList = Common.XMLDictionaryList(_systemService, "16");
                activeStatusList.Add(new Model.System.XMLDictionary {
                    key = 0, value = Resources.Common.All
                });
                activeStatusStore.DataSource = activeStatusList;
                activeStatusStore.DataBind();
                inactivePref.Select("0");


                Store1.Reload();
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest && !IsPostBack)
            {
                SetExtLanguage();
                HideShowButtons();
                HideShowColumns();

                if (!string.IsNullOrEmpty(Request.QueryString["_employeeId"]) && !string.IsNullOrEmpty(Request.QueryString["_fromDayId"]) && !string.IsNullOrEmpty(Request.QueryString["_toDayId"]))
                {
                    dateRange1.DefaultStartDate = DateTime.ParseExact(Server.UrlDecode(Request.QueryString["_fromDayId"]).Trim('\''), "yyyyMMdd", new CultureInfo("en"));
                    dateRange1.DefaultEndDate   = DateTime.ParseExact(Server.UrlDecode(Request.QueryString["_toDayId"]).Trim('\''), "yyyyMMdd", new CultureInfo("en"));
                }
                //try
                //{
                //    AccessControlApplier.ApplyAccessControlOnPage(typeof(RT305), null, GridPanel1, null, null);
                //}
                //catch (AccessDeniedException exp)
                //{
                //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied).Show();
                //    Viewport1.Hidden = true;
                //    return;
                //}
                if (!string.IsNullOrEmpty(Request.QueryString["_employeeId"]) && !string.IsNullOrEmpty(Request.QueryString["_fromDayId"]) && !string.IsNullOrEmpty(Request.QueryString["_toDayId"]))
                {
                    Store1.Reload();
                }

                dateRange1.DefaultStartDate = DateTime.Now.AddDays(-DateTime.Now.Day);
                FillStatus();
                timeVariationType.Select(0);
            }
        }
예제 #5
0
        public void RejectRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                RecordRequest req = new RecordRequest();
                req.RecordID = index;


                RecordResponse <DashBoardTimeVariation> r = _timeAttendanceService.ChildGetRecord <DashBoardTimeVariation>(req);                    //Step 1 Selecting the object or building up the object for update purpose

                if (!r.Success)
                {
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    RejectTimeVariationc rejectObject = new RejectTimeVariationc();
                    rejectObject.clockDuration = r.result.clockDuration;
                    rejectObject.damageLevel   = r.result.damageLevel;
                    rejectObject.date          = r.result.date;
                    rejectObject.dayId         = r.result.dayId;
                    rejectObject.dtFrom        = r.result.dtFrom;
                    rejectObject.dtTo          = r.result.dtTo;
                    rejectObject.duration      = r.result.duration;
                    rejectObject.employeeId    = r.result.employeeId;
                    rejectObject.recordId      = r.result.recordId;
                    rejectObject.shiftId       = r.result.shiftId;
                    rejectObject.timeCode      = r.result.timeCode;
                    rejectObject.justification = r.result.justification;
                    rejectObject.apId          = r.result.apId;



                    PostRequest <RejectTimeVariationc> rejReq = new PostRequest <RejectTimeVariationc>();
                    rejReq.entity = rejectObject;


                    rejReq.entity.apStatus = -1;
                    PostResponse <RejectTimeVariationc> rejResp = _timeAttendanceService.ChildAddOrUpdate <RejectTimeVariationc>(rejReq);

                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordUpdatedSucc
                    });
                }
                Store1.Reload();
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
예제 #6
0
파일: RT107.aspx.cs 프로젝트: EliasTous/ERP
        protected void Prev_Click(object sender, DirectEventArgs e)
        {
            int index = int.Parse(e.ExtraParams["index"]);

            if ((index - 1) >= 0)
            {
                this.Viewport1.ActiveIndex = index - 1;
                Store1.Reload();
            }
        }
예제 #7
0
        public void DeleteShift(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                AttendanceShift s = new AttendanceShift();
                s.recordId   = index;
                s.dayId      = CurrentDay.Text;
                s.employeeId = CurrentEmployee.Text;
                s.checkIn    = "00:00";
                s.checkOut   = "00:00";
                PostRequest <AttendanceShift> req = new PostRequest <AttendanceShift>();
                req.entity = s;
                PostResponse <AttendanceShift> resp = _timeAttendanceService.ChildDelete <AttendanceShift>(req);
                if (!resp.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(resp);
                    return;
                }
                SynchronizeAttendanceDay GD = new SynchronizeAttendanceDay();
                PostRequest <SynchronizeAttendanceDay> request = new PostRequest <SynchronizeAttendanceDay>();
                GD.employeeId  = Convert.ToInt32(CurrentEmployee.Text);
                GD.fromDayId   = CurrentDay.Text;
                GD.toDayId     = CurrentDay.Text;
                request.entity = GD;


                PostResponse <SynchronizeAttendanceDay> resp1 = _helpFunctionService.ChildAddOrUpdate <SynchronizeAttendanceDay>(request);
                //Step 2 :  remove the object from the store

                if (!resp1.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", resp1.ErrorCode) != null ? GetGlobalResourceObject("Errors", resp1.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp1.LogId : resp1.Summary).Show();
                    return;
                }
                attendanceShiftStore.Remove(index);
                //Step 3 : Showing a notification for the user
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordDeletedSucc
                });

                Store1.Reload();
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
예제 #8
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string   obj = e.ExtraParams["values"];
            TimeCode b   = JsonConvert.DeserializeObject <TimeCode>(obj);

            //if (!string.IsNullOrEmpty(timeCodeCombo.Value.ToString()))
            //    b.timeCode = Convert.ToInt16(timeCodeCombo.Value.ToString());

            // Define the object to add or edit as null
            try
            {
                //New Mode
                //Step 1 : Fill The object and insert in the store
                PostRequest <TimeCode> request = new PostRequest <TimeCode>();

                request.entity = b;
                PostResponse <TimeCode> r = _payrollService.ChildAddOrUpdate <TimeCode>(request);


                //check if the insert failed
                if (!r.Success)//it maybe be another condition
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);;
                    return;
                }
                else
                {
                    //Add this record to the store
                    Store1.Reload();

                    //Display successful notification
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });

                    this.EditRecordWindow.Close();
                }
            }
            catch (Exception ex)
            {
                //Error exception displaying a messsage box
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
            }
        }
예제 #9
0
        protected void deleteRow(object sender, DirectEventArgs e)
        {
            db = new demoDB();
            string         varID = e.ExtraParams["Id"];
            var            ID    = int.Parse(varID);
            SpacialDataSet sd    = (from i in db.SpacialDataSets where i.Id == ID select i).SingleOrDefault();

            sd.active = false;
            db.SaveChanges();
            //ChargeGridPanel();
            Store1.Reload();
        }
        protected void cmdSAVE(object sender, DirectEventArgs e)
        {
            string sSQL      = "";
            string GroupUsed = "N";
            ChangeRecords <ITEM_GROUP> sdh = new StoreDataHandler(e.ExtraParams["data"]).BatchObjectData <ITEM_GROUP>();

            foreach (ITEM_GROUP updated in sdh.Created)
            {
                if (updated.USED.ToString() == "true")
                {
                    GroupUsed = "Y";
                }
                sSQL  = "INSERT INTO a_item_group ";
                sSQL += "(GROUP_CODE, GROUP_NAME, GROUP_NAME_E, GROUP_CLASS, GROUP_USED) ";
                sSQL += "VALUES ('" + updated.GROUP_CODE + "', ";
                sSQL += "'" + updated.GROUP_NAME + "', ";
                sSQL += "'" + updated.GROUP_NAME_E + "', ";
                sSQL += "'" + updated.GROUP_CLASS + "', ";
                sSQL += "'" + GroupUsed + "') ";
                db.Excute(sSQL);
            }

            foreach (ITEM_GROUP updated in sdh.Updated)
            {
                if (updated.USED.ToString() == "true")
                {
                    GroupUsed = "Y";
                }
                sSQL  = "UPDATE a_item_group ";
                sSQL += "SET GROUP_NAME='" + updated.GROUP_NAME + "', ";
                sSQL += "GROUP_NAME_E='" + updated.GROUP_NAME_E + "', ";
                sSQL += "GROUP_CLASS='" + updated.GROUP_CLASS + "', ";
                sSQL += "GROUP_USED='" + GroupUsed + "' ";
                sSQL += "WHERE GROUP_CODE='" + updated.GROUP_CODE + "'; ";
                db.Excute(sSQL);
            }
            Store1.CommitChanges();
            Store1.Reload();
            btnCancel.Disabled = true;
            btnSave.Disabled   = true;
            btnDelete.Disabled = true;
            btnAdd.Disabled    = false;
        }
예제 #11
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                Service s = new Service();
                s.recordId = index;

                s.name = "";

                PostRequest <Service> req = new PostRequest <Service>();
                req.entity = s;
                PostResponse <Service> r = _taskScheduleService.ChildDelete <Service>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });

                    Store1.Reload();
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
예제 #12
0
        public void DeleteRecord(string id, string employeeId, string returnType)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                LeaveReturn s = new LeaveReturn();
                s.leaveId    = id;
                s.employeeId = employeeId;
                s.returnType = returnType;
                //s.reference = "";


                PostRequest <LeaveReturn> req = new PostRequest <LeaveReturn>();
                req.entity = s;
                PostResponse <LeaveReturn> r = _leaveManagementService.ChildDelete <LeaveReturn>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
예제 #13
0
        public void DeleteRecord(string ruleId, string classId, string accessType, string seqNo)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                RuleTrigger s = new RuleTrigger();
                s.ruleId     = ruleId;
                s.classId    = classId;
                s.accessType = accessType;
                s.seqNo      = seqNo;
                PostRequest <RuleTrigger> req = new PostRequest <RuleTrigger>();
                req.entity = s;
                PostResponse <RuleTrigger> r = _companyStructureService.ChildDelete <RuleTrigger>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
예제 #14
0
        protected void SaveAlerts(object sender, DirectEventArgs e)
        {
            string values = e.ExtraParams["values"];

            List <SystemAlert> alerts = JsonConvert.DeserializeObject <List <SystemAlert> >(values);

            alerts.ForEach(x =>
            {
                if (x.isActive)
                {
                    x.activeStatus = (Int16)ActiveStatus.ACTIVE;
                }
                else
                {
                    x.activeStatus = (Int16)ActiveStatus.INACTIVE;
                }
            });
            PostRequest <SystemAlert[]> req = new PostRequest <SystemAlert[]>();

            req.entity = alerts.ToArray();

            PostResponse <SystemAlert[]> resp = _systemService.ChildAddOrUpdate <SystemAlert[]>(req);

            if (!resp.Success)

            {
                Common.errorMessage(resp);
                return;
            }
            Notification.Show(new NotificationConfig
            {
                Title = Resources.Common.Notification,
                Icon  = Icon.Information,
                Html  = Resources.Common.RecordUpdatedSucc
            });
            Store1.Reload();
        }
예제 #15
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string            obj = e.ExtraParams["values"];
            LetterSelfservice b   = JsonConvert.DeserializeObject <LetterSelfservice>(obj);

            b.employeeId = Convert.ToInt32(_systemService.SessionHelper.GetEmployeeId());

            b.recordId = id;
            // Define the object to add or edit as null
            ApplyLetterRecordRequest req = new ApplyLetterRecordRequest();

            req.ltId       = Convert.ToInt32(ltId.SelectedItem.Value.ToString());
            req.employeeId = b.employeeId;
            RecordResponse <ApplyLetter> res = _systemService.ChildGetRecord <ApplyLetter>(req);

            b.bodyText = res.result.bodyText;
            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <LetterSelfservice> request = new PostRequest <LetterSelfservice>();
                    request.entity = b;
                    PostResponse <LetterSelfservice> r = _selfServiceService.ChildAddOrUpdate <LetterSelfservice>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        //this.Store1.Insert(0, b);

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        //sm.DeselectAll();
                        //sm.Select(b.recordId.ToString());
                        Store1.Reload();
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record
                    PostRequest <LetterSelfservice> request = new PostRequest <LetterSelfservice>();
                    request.entity = b;
                    PostResponse <LetterSelfservice> r = _selfServiceService.ChildAddOrUpdate <LetterSelfservice>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                        return;
                    }
                    else
                    {
                        //ModelProxy record = this.Store1.GetById(index);
                        //BasicInfoTab.UpdateRecord(record);
                        //record.Commit();
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #16
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            socialSetupStore.Reload();


            //Getting the id to check if it is an Add or an edit as they are managed within the same form.

            string obj = e.ExtraParams["values"];
            SocialSecuritySchedule b = JsonConvert.DeserializeObject <SocialSecuritySchedule>(obj);

            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <SocialSecuritySchedule> request = new PostRequest <SocialSecuritySchedule>();

                    request.entity          = b;
                    request.entity.recordId = SocailSecurityrecordId.Text;


                    PostResponse <SocialSecuritySchedule> r = _PayrollService.ChildAddOrUpdate <SocialSecuritySchedule>(request);

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(SocailSecurityrecordId.Text))
                        {
                            b.recordId = r.recordId;
                            //Add this record to the store
                            this.Store1.Insert(0, b);

                            this.EditRecordWindow.Close();
                            RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                            sm.DeselectAll();
                            sm.Select(b.recordId.ToString());

                            socialSetupStore.Reload();
                        }

                        Store1.Reload();
                        SocailSecurityrecordId.Text = r.recordId;

                        socialSetupGrid.Disabled = false;



                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <SocialSecuritySchedule> request = new PostRequest <SocialSecuritySchedule>();
                    request.entity = b;
                    PostResponse <SocialSecuritySchedule> r = _PayrollService.ChildAddOrUpdate <SocialSecuritySchedule>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }

                    else
                    {
                        ModelProxy record = this.Store1.GetById(id);
                        BasicInfoTab.UpdateRecord(record);
                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        Store1.Reload();
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #17
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string          obj = e.ExtraParams["values"];
            PayrollConstant b   = JsonConvert.DeserializeObject <PayrollConstant>(obj);

            PostRequest <PayrollConstant> request = new PostRequest <PayrollConstant>();

            request.entity = b;
            PostResponse <PayrollConstant> r = _payrollService.ChildAddOrUpdate <PayrollConstant>(request);


            //check if the insert failed
            if (!r.Success)//it maybe be another condition
            {
                //Show an error saving...
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(r);
                return;
            }
            else
            {
                //Add this record to the store
                Store1.Reload();

                //Display successful notification
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordSavingSucc
                });

                this.EditRecordWindow.Close();
                // Define the object to add or edit as null

                //    if (string.IsNullOrEmpty(id))
                //{

                //    try
                //    {
                //        //New Mode
                //        //Step 1 : Fill The object and insert in the store
                //        PostRequest<CertificateLevel> request = new PostRequest<CertificateLevel>();

                //        request.entity = b;
                //        PostResponse<CertificateLevel> r = _employeeService.ChildAddOrUpdate<CertificateLevel>(request);


                //        //check if the insert failed
                //        if (!r.Success)//it maybe be another condition
                //        {
                //            //Show an error saving...
                //            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //            Common.errorMessage(r);
                //            return;
                //        }
                //        else
                //        {
                //            b.recordId = r.recordId;
                //            //Add this record to the store
                //            this.Store1.Insert(0, b);

                //            //Display successful notification
                //            Notification.Show(new NotificationConfig
                //            {
                //                Title = Resources.Common.Notification,
                //                Icon = Icon.Information,
                //                Html = Resources.Common.RecordSavingSucc
                //            });

                //            this.EditRecordWindow.Close();
                //            RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                //            sm.DeselectAll();
                //            sm.Select(b.recordId.ToString());



                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        //Error exception displaying a messsage box
                //        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                //    }


                //}
                //else
                //{
                //    //Update Mode

                //    try
                //    {
                //        //getting the id of the record
                //        PostRequest<CertificateLevel> request = new PostRequest<CertificateLevel>();
                //        request.entity = b;
                //        PostResponse<CertificateLevel> r = _employeeService.ChildAddOrUpdate<CertificateLevel>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                //        //Step 2 : saving to store

                //        //Step 3 :  Check if request fails
                //        if (!r.Success)//it maybe another check
                //        {
                //            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //            Common.errorMessage(r);
                //            return;
                //        }
                //        else
                //        {


                //            ModelProxy record = this.Store1.GetById(id);
                //            BasicInfoTab.UpdateRecord(record);
                //            record.Commit();
                //            Notification.Show(new NotificationConfig
                //            {
                //                Title = Resources.Common.Notification,
                //                Icon = Icon.Information,
                //                Html = Resources.Common.RecordUpdatedSucc
                //            });
                //            this.EditRecordWindow.Close();


                //        }

                //    }
                //    catch (Exception ex)
                //    {
                //        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                //    }
                //}
            }
        }
예제 #18
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            try
            {
                string          obj           = e.ExtraParams["values"];
                string          ldMethodParam = e.ExtraParams["ldMethod"];
                string          ldValueParam  = e.ExtraParams["ldValue"];
                loanSelfService b             = JsonConvert.DeserializeObject <loanSelfService>(obj);

                string id = e.ExtraParams["id"];
                if (string.IsNullOrEmpty(id))
                {
                    if (!string.IsNullOrEmpty(ldValueParam))
                    {
                        b.ldValue = Convert.ToDouble(ldValueParam);
                    }
                    if (!string.IsNullOrEmpty(ldMethodParam))
                    {
                        b.ldMethod = Convert.ToInt16(ldMethodParam);
                    }

                    if (b.ldMethod == null)
                    {
                        req.Key = "ldMethod";
                        RecordResponse <KeyValuePair <string, string> > defaults = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);
                        if (!defaults.Success)
                        {
                            Common.errorMessage(defaults);
                            return;
                        }
                        if (!string.IsNullOrEmpty(defaults.result.Value))
                        {
                            b.ldMethod = Convert.ToInt16(defaults.result.Value);
                        }
                    }
                    if (b.ldValue == null)
                    {
                        req.Key = "ldValue";
                        RecordResponse <KeyValuePair <string, string> > ldValueResponse = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);
                        if (!ldValueResponse.Success)
                        {
                            Common.errorMessage(ldValueResponse);
                            return;
                        }
                        if (!string.IsNullOrEmpty(ldValueResponse.result.Value))
                        {
                            b.ldValue = Convert.ToInt16(ldValueResponse.result.Value);
                        }
                    }
                }
                if (b.ldMethod == null)
                {
                    X.MessageBox.Alert(GetGlobalResourceObject("Common", "Error").ToString(), GetGlobalResourceObject("Errors", "emptyLdMethod").ToString()).Show();
                    return;
                }



                //if (string.IsNullOrEmpty(ldMethod)
                //b.ldMethod =Convert.ToInt16( ldMethod);
                // Define the object to add or edit as null


                //if (ldMethodCom.SelectedItem != null)
                //    b.ldMethod = ldMethodCom.SelectedItem.Value;

                if (date.ReadOnly)
                {
                    b.date = DateTime.Now;
                }
                //b.effectiveDate = new DateTime(b.effectiveDate.Year, b.effectiveDate.Month, b.effectiveDate.Day, 14, 0, 0);

                if (branchId.SelectedItem != null)
                {
                    b.branchName = branchId.SelectedItem.Text;
                }


                if (string.IsNullOrEmpty(id))
                {
                    try
                    {
                        //New Mode
                        //Step 1 : Fill The object and insert in the store
                        PostRequest <loanSelfService> request = new PostRequest <loanSelfService>();
                        request.entity            = b;
                        request.entity.employeeId = _systemService.SessionHelper.GetEmployeeId();
                        //  request.entity.employeeName = new EmployeeName() { fullName="" };
                        request.entity.date = DateTime.Now;
                        //request.entity.ltName = "";
                        //request.entity.currencyRef = "";



                        request.entity.apStatus = "1";
                        PostResponse <loanSelfService> r = _selfServiceService.ChildAddOrUpdate <loanSelfService>(request);
                        //check if the insert failed
                        if (!r.Success)//it maybe be another condition
                        {
                            //Show an error saving...
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(r);
                            return;
                        }

                        else
                        {
                            Store1.Reload();
                            //b.recordId = r.recordId;

                            ////Add this record to the store
                            //this.Store1.Insert(0, b);

                            //Display successful notification
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordSavingSucc
                            });
                            recordId.Text = b.recordId;
                            SetTabPanelEnable(true);
                            currentCase.Text = b.recordId;

                            RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                            sm.DeselectAll();
                            sm.Select(b.recordId.ToString());

                            this.EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        //Error exception displaying a messsage box
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                    }
                }
                else
                {
                    //Update Mode

                    try
                    {
                        //getting the id of the record
                        PostRequest <loanSelfService> request = new PostRequest <loanSelfService>();
                        request.entity            = b;
                        request.entity.employeeId = _systemService.SessionHelper.GetEmployeeId();



                        PostResponse <loanSelfService> r = _selfServiceService.ChildAddOrUpdate <loanSelfService>(request);                    //Step 1 Selecting the object or building up the object for update purpose

                        //Step 2 : saving to store

                        //Step 3 :  Check if request fails
                        if (!r.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(r);
                            return;
                        }
                        else
                        {
                            Store1.Reload();

                            // ModelProxy record = this.Store1.GetById(id);
                            // BasicInfoTab.UpdateRecord(record);
                            // record.Set("currencyRef", b.currencyRef);
                            // if (date.ReadOnly)
                            //     record.Set("date", null);

                            // record.Set("employeeName", b.employeeName);

                            //// record.Set("branchName", b.branchName);

                            // record.Commit();
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordUpdatedSucc
                            });
                            this.EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                    }
                }
            }
            catch (Exception ex)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, ex.Message).Show();
            }
        }
예제 #19
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string       obj = e.ExtraParams["values"];
            LeavePayment b   = JsonConvert.DeserializeObject <LeavePayment>(obj);

            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null

            //  b.employeeName = new EmployeeName();
            //if (ldMethodCom.SelectedItem != null)
            //    b.ldMethod = ldMethodCom.SelectedItem.Value;
            if (employeeId.SelectedItem != null)
            {
                b.employeeName = employeeId.SelectedItem.Text;
            }

            if (date.ReadOnly)
            {
                b.date = DateTime.Now;
            }
            //b.effectiveDate = new DateTime(b.effectiveDate.Year, b.effectiveDate.Month, b.effectiveDate.Day, 14, 0, 0);


            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <LeavePayment> request = new PostRequest <LeavePayment>();
                    request.entity = b;
                    PostResponse <LeavePayment> r = _payrollService.ChildAddOrUpdate <LeavePayment>(request);
                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }

                    else
                    {
                        b.recordId = r.recordId;

                        //Add this record to the store
                        //this.Store1.Insert(0, b);

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                        recordId.Text = b.recordId;

                        currentCase.Text = b.recordId;

                        //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        //sm.DeselectAll();
                        //sm.Select(b.recordId.ToString());
                        Store1.Reload();
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <LeavePayment> request = new PostRequest <LeavePayment>();
                    request.entity = b;
                    PostResponse <LeavePayment> r = _payrollService.ChildAddOrUpdate <LeavePayment>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.Store1.GetById(id);
                        BasicInfoTab.UpdateRecord(record);

                        if (date.ReadOnly)
                        {
                            record.Set("date", null);
                        }

                        record.Set("employeeName", b.employeeName);



                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #20
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string obj  = e.ExtraParams["values"];
            string addr = e.ExtraParams["address"];
            Branch b    = JsonConvert.DeserializeObject <Branch>(obj);

            b.managerId = managerId.Value.ToString();

            b.isInactive   = isInactive.Checked;
            b.activeStatus = isInactive.Checked ? Convert.ToInt16(ActiveStatus.INACTIVE) : Convert.ToInt16(ActiveStatus.ACTIVE);
            b.recordId     = id;
            // Define the object to add or edit as null
            CustomResolver res = new CustomResolver();

            res.AddRule("naId", "countryId");
            res.AddRule("stId", "stateId");
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ContractResolver = res;
            b.caName = caId.SelectedItem.Text;
            AddressBook add = JsonConvert.DeserializeObject <AddressBook>(addr, settings);

            if (string.IsNullOrEmpty(add.city) && string.IsNullOrEmpty(add.countryId) && string.IsNullOrEmpty(add.street1) && string.IsNullOrEmpty(add.stateId) && string.IsNullOrEmpty(add.phone))
            {
                b.address = null;
            }
            else
            {
                if (string.IsNullOrEmpty(add.city) || string.IsNullOrEmpty(add.countryId) || string.IsNullOrEmpty(add.street1) || string.IsNullOrEmpty(add.stateId) || string.IsNullOrEmpty(add.phone))
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, GetLocalResourceObject("ErrorAddressMissing")).Show();
                    return;
                }
                b.address          = JsonConvert.DeserializeObject <AddressBook>(addr, settings);
                b.address.recordId = address.Text;
            }

            if (string.IsNullOrEmpty(branchId.Text))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Branch> request = new PostRequest <Branch>();
                    request.entity = b;
                    PostResponse <Branch> r = _branchService.ChildAddOrUpdate <Branch>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", r.ErrorCode) != null ? GetGlobalResourceObject("Errors", r.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + r.LogId :r.Summary).Show();
                        return;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(branchId.Text))
                        {
                            //this.Store1.Insert(0, b);


                            this.EditRecordWindow.Close();
                            //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                            //sm.DeselectAll();
                            //sm.Select(b.recordId.ToString());
                        }

                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                        //Add this record to the store
                        managerId.Disabled = false;

                        //Display successful notification
                        branchId.Text = b.recordId;
                        Store1.Reload();
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(branchId.Text);//getting the id of the record
                    PostRequest <Branch> request = new PostRequest <Branch>();
                    b.recordId     = branchId.Text;
                    request.entity = b;
                    PostResponse <Branch> r = _branchService.ChildAddOrUpdate <Branch>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.Store1.GetById(index);
                        record.Set("caName", b.caName);
                        BasicInfoTab.UpdateRecord(record);

                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        //    this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #21
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string   obj = e.ExtraParams["values"];
            Division b   = JsonConvert.DeserializeObject <Division>(obj);

            //  b.isInactive = isInactive.Checked;
            b.recordId = id;
            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Division> request = new PostRequest <Division>();
                    request.entity = b;
                    PostResponse <Division> r = _branchService.ChildAddOrUpdate <Division>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;

                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", r.ErrorCode) != null ? GetGlobalResourceObject("Errors", r.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + r.LogId : r.Summary).Show();

                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        Store1.Reload();

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record
                    PostRequest <Division> request = new PostRequest <Division>();
                    request.entity = b;
                    PostResponse <Division> r = _branchService.ChildAddOrUpdate <Division>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #22
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string     obj = e.ExtraParams["schedule"];
            FiscalYear b   = JsonConvert.DeserializeObject <FiscalYear>(obj);


            // Define the object to add or edit as null


            try
            {
                //New Mode
                //Step 1 : Fill The object and insert in the store
                PostRequest <FiscalYear> request = new PostRequest <FiscalYear>();
                request.entity = b;
                if (b.startDate > b.endDate)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, GetLocalResourceObject("ErrorStartEnd").ToString()).Show();
                    return;
                }
                PostResponse <FiscalYear> r = _payrollService.ChildAddOrUpdate <FiscalYear>(request);


                //check if the insert failed
                if (!r.Success)//it maybe be another condition
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }



                else
                {
                    //Add this record to the store
                    Store1.Reload();

                    //Display successful notification
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });

                    this.EditRecordWindow.Close();
                    RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                    sm.DeselectAll();
                    sm.Select(b.fiscalYear.ToString());
                }
            }
            catch (Exception ex)
            {
                //Error exception displaying a messsage box
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
            }
        }
예제 #23
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string           obj         = e.ExtraParams["schedule"];
            PayrollIndemnity b           = JsonConvert.DeserializeObject <PayrollIndemnity>(obj);
            string           pers        = e.ExtraParams["periods"];
            string           indemnities = e.ExtraParams["indemnities"];

            b.recordId = id;
            // Define the object to add or edit as null
            List <PayrollIndemnityDetails>     periods         = JsonConvert.DeserializeObject <List <PayrollIndemnityDetails> >(pers);
            List <PayrollIndemnityRecognition> indemnitiesList = JsonConvert.DeserializeObject <List <PayrollIndemnityRecognition> >(indemnities);

            if (periods == null || periods.Count == 0 || indemnitiesList == null || indemnitiesList.Count == 0)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", "Error_Empty_IndemnityDetails_IndemnityResignation")).Show();
                return;
            }
            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <PayrollIndemnity> request = new PostRequest <PayrollIndemnity>();
                    request.entity = b;
                    PostResponse <PayrollIndemnity> r = _payrollService.ChildAddOrUpdate <PayrollIndemnity>(request);
                    b.recordId = r.recordId;



                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }

                    PostResponse <PayrollIndemnityDetails[]> result = AddPeriodsList(b.recordId, periods);
                    //  AddPeriodsList1(b.recordId, periods);


                    if (!result.Success)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : result.Summary).Show();
                        return;
                    }


                    PostResponse <PayrollIndemnityRecognition[]> result1 = AddindemnitiesList(b.recordId, indemnitiesList);
                    //  AddPeriodsList1(b.recordId, periods);

                    if (!result1.Success)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : result.Summary).Show();
                        return;
                    }

                    else
                    {
                        //Add this record to the store
                        this.Store1.Insert(0, b);

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record
                    PostRequest <PayrollIndemnity> modifyHeaderRequest = new PostRequest <PayrollIndemnity>();
                    modifyHeaderRequest.entity = b;

                    PostResponse <PayrollIndemnity> r = _payrollService.ChildAddOrUpdate <PayrollIndemnity>(modifyHeaderRequest);

                    //Step 1 Selecting the object or building up the object for update purpose
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                        return;
                    }
                    //List<PayrollIndemnityDetails> periods = JsonConvert.DeserializeObject<List<PayrollIndemnityDetails>>(pers);
                    //List<PayrollIndemnityRecognition> indemnitiesList = JsonConvert.DeserializeObject<List<PayrollIndemnityRecognition>>(indemnities);
                    //if (periods == null || periods.Count == 0 || indemnitiesList == null || indemnitiesList.Count == 0)
                    //{
                    //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    //    X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", "Error_Empty_IndemnityDetails_IndemnityResignation")).Show();
                    //    return;

                    //}

                    //_payrollService.DeleteVacationSchedulePeriods(Convert.ToInt32(b.recordId));
                    DeleteVacationSchedulePeriods(Convert.ToInt32(b.recordId));
                    //if (!deleteDesponse.Success)//it maybe another check
                    // {
                    //     X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    //      X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", deleteDesponse.ErrorCode) != null ? GetGlobalResourceObject("Errors", deleteDesponse.ErrorCode).ToString() : deleteDesponse.Summary).Show();
                    //     return;
                    // }

                    PostResponse <PayrollIndemnityDetails[]> result = AddPeriodsList(b.recordId, periods);

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!result.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : result.Summary).Show();
                        return;
                    }


                    PostResponse <PayrollIndemnityRecognition[]> result1 = AddindemnitiesList(b.recordId, indemnitiesList);
                    //  AddPeriodsList1(b.recordId, periods);

                    if (!result1.Success)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : GetGlobalResourceObject("Errors", result.ErrorCode) != null ? GetGlobalResourceObject("Errors", result.ErrorCode).ToString() : result.Summary).Show();
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.Store1.GetById(index);
                        BasicInfoTab.UpdateRecord(record);

                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
            Store1.Reload();
        }
예제 #24
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string               obj = e.ExtraParams["values"];
            PenaltyType          b   = JsonConvert.DeserializeObject <PenaltyType>(obj);
            List <PenaltyDetail> PD  = JsonConvert.DeserializeObject <List <PenaltyDetail> >(e.ExtraParams["codes"]);


            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null
            if (!string.IsNullOrEmpty(currentPenaltyType.Text))
            {
                id         = currentPenaltyType.Text;
                b.recordId = currentPenaltyType.Text;
            }
            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <PenaltyType> request = new PostRequest <PenaltyType>();

                    request.entity = b;
                    PostResponse <PenaltyType> r = _PayrollService.ChildAddOrUpdate <PenaltyType>(request);

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        currentPenaltyType.Text = r.recordId;



                        //PostRequest<PenaltyDetail> codesReq = new PostRequest<PenaltyDetail>();

                        //PD.ForEach(x =>

                        //{
                        //    DeletePenaltyDetailsRecord(x);
                        //    codesReq.entity = x;
                        //    codesReq.entity.recordId = null;
                        //    PostResponse<PenaltyDetail> codesResp = _PayrollService.ChildAddOrUpdate<PenaltyDetail>(codesReq);
                        //    if (!codesResp.Success)//it maybe be another condition
                        //{
                        //    //Show an error saving...
                        //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        //        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", codesResp.ErrorCode) != null ? GetGlobalResourceObject("Errors", codesResp.ErrorCode).ToString() : codesResp.Summary).Show();
                        //        throw new Exception();
                        //    }
                        //});


                        Store1.Reload();
                        penaltyDetailGrid.Disabled = false;

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });


                        //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        //sm.DeselectAll();
                        //sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message != null)
                    {
                        //Error exception displaying a messsage box
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, ex.Message).Show();
                    }
                }
            }
            else
            {
                penaltyDetailGrid.Disabled = false;
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <PenaltyType> request = new PostRequest <PenaltyType>();
                    request.entity = b;
                    PostResponse <PenaltyType> r = _PayrollService.ChildAddOrUpdate <PenaltyType>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        DeleteAllPenaltyDetailsRecords(damage.Value.ToString());
                        PostRequest <PenaltyDetail> codesReq = new PostRequest <PenaltyDetail>();
                        PD.ForEach(x =>
                        {
                            codesReq.entity          = x;
                            codesReq.entity.recordId = null;

                            PostResponse <PenaltyDetail> codesResp = _PayrollService.ChildAddOrUpdate <PenaltyDetail>(codesReq);

                            if (!codesResp.Success)//it maybe be another condition
                            {
                                //Show an error saving...
                                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", codesResp.ErrorCode) != null ? GetGlobalResourceObject("Errors", codesResp.ErrorCode).ToString() : codesResp.Summary).Show();
                                throw new Exception();
                            }
                        });

                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #25
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string obj = e.ExtraParams["values"];

            AssetManagementPurchaseOrder b = JsonConvert.DeserializeObject <AssetManagementPurchaseOrder>(obj);

            b.supplierId = supplierId.GetSupplierId() == "0" ? null : supplierId.GetSupplierId();
            b.categoryId = categoryId.GetCategoryId();
            b.currencyId = CurrencyControl.getCurrency() == "0"?null : CurrencyControl.getCurrency();
            b.apStatus   = apStatus.GetApprovalStatus() == "0" ? null : apStatus.GetApprovalStatus();

            b.recordId = id;
            // Define the object to add or edit as null



            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <AssetManagementPurchaseOrder> request = new PostRequest <AssetManagementPurchaseOrder>();
                    request.entity = b;
                    PostResponse <AssetManagementPurchaseOrder> resp = _assetManagementService.ChildAddOrUpdate <AssetManagementPurchaseOrder>(request);
                    b.recordId = resp.recordId;

                    //check if the insert failed
                    if (!resp.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(resp);
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        this.EditRecordWindow.Close();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                        //Add this record to the store
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    PostRequest <AssetManagementPurchaseOrder> request = new PostRequest <AssetManagementPurchaseOrder>();
                    b.recordId     = id;
                    request.entity = b;
                    PostResponse <AssetManagementPurchaseOrder> r = _assetManagementService.ChildAddOrUpdate <AssetManagementPurchaseOrder>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        //    this.EditRecordWindow.Close();
                    }
                    AssetPOReception POReception = JsonConvert.DeserializeObject <AssetPOReception>(obj);
                    POReception.recordId   = id;
                    POReception.supplierId = supplierId.GetSupplierId() == "0" ? null : supplierId.GetSupplierId();
                    POReception.categoryId = categoryId.GetCategoryId();
                    POReception.currencyId = CurrencyControl.getCurrency() == "0" ? null : CurrencyControl.getCurrency();
                    POReception.apStatus   = apStatus.GetApprovalStatus() == "0" ? null : apStatus.GetApprovalStatus();
                    if (b.status == 2)
                    {
                        PostRequest <AssetPOReception> req = new PostRequest <AssetPOReception>();
                        req.entity = POReception;
                        PostResponse <AssetPOReception> resp = _assetManagementService.ChildAddOrUpdate <AssetPOReception>(req);
                        if (!resp.Success)//it maybe another check
                        {
                            Common.errorMessage(resp);
                            return;
                        }
                        AssetManagementAssetListRequest request1 = new AssetManagementAssetListRequest();

                        request1.branchId        = "0";
                        request1.departmentId    = "0";
                        request1.positionId      = "0";
                        request1.categoryId      = "0";
                        request1.employeeId      = "0";
                        request1.supplierId      = "0";
                        request1.PurchaseOrderId = b.poRef;
                        request1.Filter          = "";
                        ListResponse <AssetManagementAsset> resp1 = _assetManagementService.ChildGetAll <AssetManagementAsset>(request1);
                        if (!resp1.Success)//it maybe another check
                        {
                            Common.errorMessage(resp1);
                            return;
                        }
                        FillCondition();
                        AssetPOReceptionStore.DataSource = resp1.Items;
                        AssetPOReceptionStore.DataBind();

                        AssetPOReceptionWindow.Show();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
예제 #26
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            try
            {
                //Getting the id to check if it is an Add or an edit as they are managed within the same form.
                string id = e.ExtraParams["id"];


                string obj            = e.ExtraParams["values"];
                AssetManagementLoan b = JsonConvert.DeserializeObject <AssetManagementLoan>(obj);
                if (!string.IsNullOrEmpty(apId.GetApprovalStatus()))
                {
                    b.status = Convert.ToInt16(apId.GetApprovalStatus());
                }
                b.assetId = assetId.GetAssetId();



                // Define the object to add or edit as null

                if (string.IsNullOrEmpty(id))
                {
                    try
                    {
                        //New Mode
                        //Step 1 : Fill The object and insert in the store
                        PostRequest <AssetManagementLoan> request = new PostRequest <AssetManagementLoan>();
                        request.entity = b;
                        PostResponse <AssetManagementLoan> r = _assetManagementService.ChildAddOrUpdate <AssetManagementLoan>(request);
                        b.recordId = r.recordId;

                        //check if the insert failed
                        if (!r.Success)//it maybe be another condition
                        {
                            //Show an error saving...

                            Common.errorMessage(r);
                            return;
                        }
                        else
                        {
                            //Add this record to the store


                            //Display successful notification
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordSavingSucc
                            });

                            this.EditRecordWindow.Close();
                            Store1.Reload();
                        }
                    }
                    catch (Exception ex)
                    {
                        //Error exception displaying a messsage box
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                    }
                }
                else
                {
                    //Update Mode

                    try
                    {
                        int index = Convert.ToInt32(id);//getting the id of the record
                        PostRequest <AssetManagementLoan> request = new PostRequest <AssetManagementLoan>();
                        request.entity          = b;
                        request.entity.recordId = index.ToString();
                        PostResponse <AssetManagementLoan> r = _assetManagementService.ChildAddOrUpdate <AssetManagementLoan>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                        //Step 2 : saving to store

                        //Step 3 :  Check if request fails
                        if (!r.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                            return;
                        }
                        else
                        {
                            Store1.Reload();
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordUpdatedSucc
                            });
                            this.EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            }
        }
예제 #27
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string obj = e.ExtraParams["values"];

            Model.Company.Structure.Rule b = JsonConvert.DeserializeObject <Model.Company.Structure.Rule>(obj);

            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(currentRuId.Text))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Model.Company.Structure.Rule> request = new PostRequest <Model.Company.Structure.Rule>();

                    request.entity = b;
                    request.entity.expressionId = expressionCombo1.getExpression();
                    PostResponse <Model.Company.Structure.Rule> r = _companyStructureService.ChildAddOrUpdate <Model.Company.Structure.Rule>(request);


                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        b.recordId = r.recordId;
                        //Add this record to the store
                        Store1.Reload();
                        currentRuId.Text        = b.recordId;
                        conditionsGrid.Disabled = false;
                        messagesGrid.Disabled   = false;
                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <Model.Company.Structure.Rule> request = new PostRequest <Model.Company.Structure.Rule>();
                    request.entity          = b;
                    request.entity.recordId = currentRuId.Text;
                    PostResponse <Model.Company.Structure.Rule> r = _companyStructureService.ChildAddOrUpdate <Model.Company.Structure.Rule>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                        currentRuId.Text = "";
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            try
            {
                //Getting the id to check if it is an Add or an edit as they are managed within the same form.

                string obj = e.ExtraParams["values"];


                JsonSerializerSettings settings = new JsonSerializerSettings();
                CustomResolver         res      = new CustomResolver();
                //  res.AddRule("leaveRequest1_employeeId", "employeeId");
                //res.AddRule("leaveRequest1_ltId", "ltId");
                // res.AddRule("leaveRequest1_status", "status");
                settings.ContractResolver = res;
                LeaveReplacementApproval b = JsonConvert.DeserializeObject <LeaveReplacementApproval>(obj, settings);
                b.apStatus = Convert.ToInt16(LeaveApprovalStatusControl.GetApprovalStatus());
                //  b.leaveDays = Convert.ToDouble(leaveDaysField.Text);
                //b.status = Convert.ToInt16(status1);
                string id = e.ExtraParams["id"];
                // Define the object to add or edit as null
                if (!b.isPaid.HasValue)
                {
                    b.isPaid = false;
                }

                if (employeeId.SelectedItem != null)
                {
                    b.employeeName = employeeId.SelectedItem.Text;
                }
                if (ltId.SelectedItem != null)
                {
                    b.ltName = ltId.SelectedItem.Text;
                }

                //List<LeaveDay> days = GenerateLeaveDays(e.ExtraParams["days"]);



                try
                {
                    LeaveReturnRecordRequest rec = new LeaveReturnRecordRequest();
                    rec.leaveId = CurrentLeaveId.Text;
                    RecordResponse <LeaveReplacementApproval> recordResponse = _selfServiceService.ChildGetRecord <LeaveReplacementApproval>(rec);


                    if (!recordResponse.Success)
                    {
                        Common.errorMessage(recordResponse);
                        return;
                    }
                    PostRequest <LeaveReplacementApproval> request = new PostRequest <LeaveReplacementApproval>();

                    request.entity = recordResponse.result;
                    request.entity.replApStatus = apStatus.GetApprovalStatus();
                    PostResponse <LeaveReplacementApproval> r = _selfServiceService.ChildAddOrUpdate <LeaveReplacementApproval>(request);


                    //check if the insert failed
                    if (!r.Success)    //it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        b.recordId = r.recordId;

                        Store1.Reload();


                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });


                        //RecordRequest rec = new RecordRequest();
                        //rec.RecordID = b.recordId;
                        //RecordResponse<LeaveRequest> recordResponse = _leaveManagementService.ChildGetRecord<LeaveRequest>(rec);
                        //if (!recordResponse.Success)
                        //{
                        //    X.Msg.Alert(Resources.Common.Error, recordResponse.Summary).Show();
                        //    return;
                        //}
                        //leaveRef.Text = recordResponse.result.leaveRef;
                        //this.EditRecordWindow.Close();
                        //SetTabPanelEnabled(true);
                        //////RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        //////sm.DeselectAll();
                        //////sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }



            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
예제 #29
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            try
            {
                //Getting the id to check if it is an Add or an edit as they are managed within the same form.
                string id           = e.ExtraParams["id"];
                string disposedDate = e.ExtraParams["disposedDate"];

                string obj             = e.ExtraParams["values"];
                AssetManagementAsset b = JsonConvert.DeserializeObject <AssetManagementAsset>(obj);
                if (!string.IsNullOrEmpty(disposedDate))
                {
                    b.depreciationDate = DateTime.Parse(disposedDate);
                }
                b.recordId   = id;
                b.supplierId = supplierId.GetSupplierId() == "0"?null: supplierId.GetSupplierId();


                // Define the object to add or edit as null

                if (string.IsNullOrEmpty(id))
                {
                    try
                    {
                        //New Mode
                        //Step 1 : Fill The object and insert in the store
                        PostRequest <AssetManagementAsset> request = new PostRequest <AssetManagementAsset>();
                        request.entity = b;
                        PostResponse <AssetManagementAsset> r = _assetManagementService.ChildAddOrUpdate <AssetManagementAsset>(request);
                        b.recordId = r.recordId;

                        //check if the insert failed
                        if (!r.Success)//it maybe be another condition
                        {
                            //Show an error saving...

                            Common.errorMessage(r);
                            return;
                        }
                        else
                        {
                            //Add this record to the store


                            //Display successful notification
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordSavingSucc
                            });


                            Store1.Reload();
                            Panel8.Disabled   = false;
                            currentAsset.Text = r.recordId;
                            X.Call("setUrlAfterNewAsset");
                        }
                    }
                    catch (Exception ex)
                    {
                        //Error exception displaying a messsage box
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                    }
                }
                else
                {
                    //Update Mode

                    try
                    {
                        int index = Convert.ToInt32(id);//getting the id of the record
                        PostRequest <AssetManagementAsset> request = new PostRequest <AssetManagementAsset>();
                        request.entity = b;
                        PostResponse <AssetManagementAsset> r = _assetManagementService.ChildAddOrUpdate <AssetManagementAsset>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                        //Step 2 : saving to store

                        //Step 3 :  Check if request fails
                        if (!r.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                            return;
                        }
                        else
                        {
                            ModelProxy record = this.Store1.GetById(index);
                            BasicInfoTab.UpdateRecord(record);
                            record.Commit();
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordUpdatedSucc
                            });
                            this.EditRecordWindow.Close();
                            Store1.Reload();
                        }
                    }
                    catch (Exception ex)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            }
        }
예제 #30
0
        protected void SaveShift(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id  = e.ExtraParams["recordId"];
            string day = e.ExtraParams["dayId"];
            string emp = e.ExtraParams["EmployeeId"];


            string          obj = e.ExtraParams["values"];
            AttendanceShift b   = JsonConvert.DeserializeObject <AttendanceShift>(obj);

            b.recordId   = id;
            b.dayId      = day;
            b.employeeId = emp;
            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <AttendanceShift> request = new PostRequest <AttendanceShift>();
                    request.entity = b;
                    PostResponse <AttendanceShift> r = _selfServiceService.ChildAddOrUpdate <AttendanceShift>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        this.attendanceShiftStore.Insert(0, b);

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditShiftWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());


                        Store1.Reload();
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record
                    PostRequest <AttendanceShift> request = new PostRequest <AttendanceShift>();
                    request.entity = b;
                    PostResponse <AttendanceShift> r = _selfServiceService.ChildAddOrUpdate <AttendanceShift>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.attendanceShiftStore.GetById(index);

                        EditShiftForm.UpdateRecord(record);
                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditShiftWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }

                Store1.Reload();
            }
        }