Esempio n. 1
0
        protected void addFolder(object sender, DirectEventArgs e)
        {
            SystemFolder dept = new SystemFolder();

            dept.name = folderId.Text;

            PostRequest <SystemFolder> depReq = new PostRequest <SystemFolder>();

            depReq.entity = dept;

            PostResponse <SystemFolder> response = _systemService.ChildAddOrUpdate <SystemFolder>(depReq);

            if (response.Success)
            {
                dept.recordId      = response.recordId;
                dtStore.DataSource = GetFolders();

                folderId.Select(response.recordId);
            }
            else
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", response.ErrorCode) != null ? GetGlobalResourceObject("Errors", response.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + response.LogId : response.Summary).Show();
                return;
            }
        }
Esempio n. 2
0
        protected void addDocumentType(object sender, DirectEventArgs e)
        {
            if (string.IsNullOrEmpty(dtId.Text))
            {
                return;
            }
            CompanyDocumentType dept = new CompanyDocumentType();

            dept.name = dtId.Text;

            PostRequest <CompanyDocumentType> depReq = new PostRequest <CompanyDocumentType>();

            depReq.entity = dept;
            PostResponse <CompanyDocumentType> response = _systemService.ChildAddOrUpdate <CompanyDocumentType>(depReq);

            if (response.Success)
            {
                dept.recordId = response.recordId;
                FillDocumentType();
                dtId.Select(dept.recordId);
            }
            else
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(response);
                return;
            }
        }
Esempio n. 3
0
        protected void addNA(object sender, DirectEventArgs e)
        {
            Nationality dept = new Nationality();

            dept.name = naId.Text;



            PostRequest <Nationality> depReq = new PostRequest <Nationality>();

            depReq.entity = dept;

            PostResponse <Nationality> response = _systemService.ChildAddOrUpdate <Nationality>(depReq);

            if (response.Success)
            {
                dept.recordId = response.recordId;
                FillNationality();
                naId.Select(response.recordId);
            }
            else
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(response);
                return;
            }
        }
Esempio n. 4
0
        protected void addST(object sender, DirectEventArgs e)
        {
            State dept = new State();

            dept.name = stId.Text;



            PostRequest <State> depReq = new PostRequest <State>();

            depReq.entity = dept;

            PostResponse <State> response = _systemService.ChildAddOrUpdate <State>(depReq);

            if (response.Success)
            {
                dept.recordId = response.recordId;
                FillState();
                stId.Select(response.recordId);
            }
            else
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(response);
                return;
            }
        }
Esempio n. 5
0
        protected void SetStarted()
        {
            BatchStatus.status = 2;
            PostRequest <BatchOperationStatus> req = new PostRequest <BatchOperationStatus>();

            req.entity = BatchStatus;
            _systemService.ChildAddOrUpdate <BatchOperationStatus>(req);
        }
Esempio n. 6
0
        public void DeleteRecord(string index)
        {
            try
            {
                WorkingCalendar c = new WorkingCalendar();
                c.name     = "";
                c.recordId = index;
                PostRequest <WorkingCalendar> req = new PostRequest <WorkingCalendar>();
                req.entity = c;

                PostResponse <WorkingCalendar> response = _branchService.ChildDelete <WorkingCalendar>(req);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                else
                {
                    //Step 1 Code to delete the object from the database
                    if (_systemService.SessionHelper.GetCalendarId().ToString() == index)
                    {
                        List <KeyValuePair <string, string> > submittedValues = new List <KeyValuePair <string, string> >();
                        submittedValues.Add(new KeyValuePair <string, string>("caId", index));
                        KeyValuePair <string, string>[] valArr = submittedValues.ToArray();
                        PostRequest <KeyValuePair <string, string>[]> reqDef = new PostRequest <KeyValuePair <string, string>[]>();
                        reqDef.entity = valArr;
                        PostResponse <KeyValuePair <string, string>[]> resp = _systemService.ChildAddOrUpdate <KeyValuePair <string, string>[]>(reqDef);
                        if (!resp.Success)
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(resp);

                            return;
                        }
                    }
                    //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
                    });
                }
            }
            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();
            }
        }
Esempio n. 7
0
        protected void addCountry(object sender, DirectEventArgs e)
        {
            if (string.IsNullOrEmpty(countryIdCombo.Text))
            {
                return;
            }
            Nationality obj = new Nationality();

            obj.name = countryIdCombo.Text;

            PostRequest <Nationality> req = new PostRequest <Nationality>();

            req.entity = obj;

            PostResponse <Nationality> response = _systemService.ChildAddOrUpdate <Nationality>(req);

            if (response.Success)
            {
                obj.recordId = response.recordId;
                FillCountry();
                countryIdCombo.Select(obj.recordId);
            }
            else
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(response);
                return;
            }
        }
        protected void addCurrency(object sender, DirectEventArgs e)
        {
            Currency obj = new Currency();

            obj.name      = currencyId.Text;
            obj.reference = currencyId.Text;
            PostRequest <Currency> req = new PostRequest <Currency>();

            req.entity = obj;
            PostResponse <Currency> response = _systemService.ChildAddOrUpdate <Currency>(req);

            if (response.Success)
            {
                obj.recordId = response.recordId;
                FillCurrency();

                currencyId.Select(obj.recordId);
            }
            else
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(response);
                return;
            }
        }
        protected void DownloadResult(object sender, DirectEventArgs e)
        {
            string attachment = "attachment; filename=MyCsvLol.csv";

            //HttpContext.Current.Response.Clear();
            //HttpContext.Current.Response.ClearHeaders();
            //HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.AddHeader("content-disposition", attachment);
            HttpContext.Current.Response.ContentType = "application/octet-stream";
            HttpContext.Current.Response.AddHeader("Pragma", "public");
            string content;

            try
            {
                content = File.ReadAllText(MapPath("~/Imports/" + _systemService.SessionHelper.Get("AccountId") + "/" + ClassId.TAOT.ToString() + ".csv"));
            }

            catch (Exception exp)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
                return;
            }
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.Write(content);
            PostRequest <BatchOperationStatus> req = new PostRequest <BatchOperationStatus>();
            BatchOperationStatus batch             = new BatchOperationStatus();

            batch.classId   = ClassId.TAOT;
            batch.status    = 0;
            batch.processed = 0;
            batch.tableSize = 0;
            req.entity      = batch;
            PostResponse <BatchOperationStatus> resp = _systemService.ChildAddOrUpdate <BatchOperationStatus>(req);

            if (!resp.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                Common.errorMessage(resp);
                return;
            }
            Viewport1.ActiveIndex = 0;
            HttpContext.Current.Response.Flush();

            Response.Close();
        }
Esempio n. 10
0
        protected void SetDefaultClick(object sender, DirectEventArgs e)
        {
            KeyValuePair <string, string> pair = new KeyValuePair <string, string>("scId", e.ExtraParams["id"].ToString());
            PostRequest <KeyValuePair <string, string> > req = new PostRequest <KeyValuePair <string, string> >();

            req.entity = pair;
            PostResponse <KeyValuePair <string, string> > resp = _systemService.ChildAddOrUpdate <KeyValuePair <string, string> >(req);

            if (!resp.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.ErrorUpdatingRecord, GetGlobalResourceObject("Errors", resp.ErrorCode) != null ? GetGlobalResourceObject("Errors", resp.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp.LogId : resp.Summary).Show();
                return;
            }
            else
            {
                X.Msg.Alert(Resources.Common.RecordSavingSucc, GetLocalResourceObject("DefaultSetSucc").ToString()).Show();
            }
        }
Esempio n. 11
0
        protected void login_Click(object sender, EventArgs e)
        {
            ResetPassword RP = new ResetPassword();

            RP.Email       = Request.QueryString["email"];
            RP.Guid        = Request.QueryString["guid"];
            RP.NewPassword = EncryptionHelper.encrypt(tbPassword.Text);
            PostRequest <ResetPassword> depReq = new PostRequest <ResetPassword>();

            depReq.entity = RP;

            PostResponse <ResetPassword> response = _systemService.ChildAddOrUpdate <ResetPassword>(depReq);

            if (response.Success)
            {
                X.Msg.Alert("Success", "Your Password Has been changed succesfully!");
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                lblError.Text = response.Error;
            }
        }
Esempio n. 12
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();
        }
Esempio n. 13
0
        private string GetNameFormat()
        {
            string format = "";
            SystemDefaultRecordRequest req = new SystemDefaultRecordRequest();

            req.Key = "nameFormat";
            RecordResponse <KeyValuePair <string, string> > r = _systemService.ChildGetRecord <KeyValuePair <string, string> >(req);

            if (!r.Success)
            {
                Common.errorMessage(r);;
                return(null);
            }
            format = r.result.Value;
            if (string.IsNullOrEmpty(r.result.Value))
            {
                PostRequest <KeyValuePair <string, string> > request = new PostRequest <KeyValuePair <string, string> >();
                request.entity = new KeyValuePair <string, string>("nameFormat", "{firstName} {lastName}");
                PostResponse <KeyValuePair <string, string> > resp = _systemService.ChildAddOrUpdate <KeyValuePair <string, string> >(request);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    return(null);
                }
                format = "{firstName} {lastName}";
            }


            string paranthized = format;

            paranthized = paranthized.Replace('{', ' ');
            paranthized = paranthized.Replace('}', ',');
            paranthized = paranthized.Substring(0, paranthized.Length - 1);
            paranthized = paranthized.Replace(" ", string.Empty);
            return(paranthized);
        }
Esempio n. 14
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            List <KeyValuePair <string, string> > submittedValues = new List <KeyValuePair <string, string> >();
            dynamic values = JsonConvert.DeserializeObject(e.ExtraParams["values"]);

            submittedValues.Add(new KeyValuePair <string, string>("countryId", values.countryId.ToString()));
            submittedValues.Add(new KeyValuePair <string, string>("currencyId", values.currencyId.ToString()));
            submittedValues.Add(new KeyValuePair <string, string>("nameFormat", values.nameFormat.ToString()));
            submittedValues.Add(new KeyValuePair <string, string>("dateFormat", values.dateFormat.ToString()));
            submittedValues.Add(new KeyValuePair <string, string>("TimeZone", values.TimeZone.ToString()));
            submittedValues.Add(new KeyValuePair <string, string>("fdow", values.fdow.ToString()));
            submittedValues.Add(new KeyValuePair <string, string>("transactionLog", values.transactionLog == null?"off":"on"));
            submittedValues.Add(new KeyValuePair <string, string>("diableCamera", values.diableCamera == null ? "off" : "on"));
            KeyValuePair <string, string>[] valArr            = submittedValues.ToArray();
            PostRequest <KeyValuePair <string, string>[]> req = new PostRequest <KeyValuePair <string, string>[]>();

            req.entity = valArr;
            PostResponse <KeyValuePair <string, string>[]> resp = _systemService.ChildAddOrUpdate <KeyValuePair <string, string>[]>(req);

            if (!resp.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, resp.Summary).Show();
                return;
            }
            else
            {
                FillDefaults(submittedValues);
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordUpdatedSucc
                });
            }
        }
Esempio n. 15
0
        protected void SaveFolder(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"];
            Attachement b   = JsonConvert.DeserializeObject <Attachement>(obj);

            b.recordId = 0;
            b.seqNo    = Convert.ToInt16(id);
            b.classId  = ClassId.DMDO;
            b.fileName = fileName.Text;
            // Define the object to add or edit as null
            b.folderName = folderId.SelectedItem.Text;


            try
            {
                //New Mode
                PostRequest <Attachement> req = new PostRequest <Attachement>();
                req.entity = b;



                PostResponse <Attachement> r = _systemService.ChildAddOrUpdate <Attachement>(req);



                //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
                {
                    ModelProxy record = this.Store1.GetById(id);

                    EditDocumentForm.UpdateRecord(record);
                    record.Set("folderName", b.folderName);


                    record.Commit();
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordUpdatedSucc
                    });
                    this.EditDocumentWindow.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();
            }
        }
        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"];
            GovernmentOrganisation b = JsonConvert.DeserializeObject <GovernmentOrganisation>(obj);

            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 <GovernmentOrganisation> request = new PostRequest <GovernmentOrganisation>();
                    request.entity = b;
                    PostResponse <GovernmentOrganisation> r = _systemService.ChildAddOrUpdate <GovernmentOrganisation>(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());
                    }
                }
                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 <GovernmentOrganisation> request = new PostRequest <GovernmentOrganisation>();
                    request.entity = b;
                    PostResponse <GovernmentOrganisation> r = _systemService.ChildAddOrUpdate <GovernmentOrganisation>(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();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
Esempio n. 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 id = e.ExtraParams["id"];

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

            b.activeStatus = isInactiveCheck.Checked ?Convert.ToInt16(ActiveStatus.INACTIVE) : Convert.ToInt16(ActiveStatus.ACTIVE);

            b.recordId = id;
            // Define the object to add or edit as null
            if (employeeId.SelectedItem != null && employeeId.SelectedItem.Value != null)
            {
                b.employeeId = employeeId.SelectedItem.Value;
                b.fullName   = employeeId.SelectedItem.Text;
            }

            if (string.IsNullOrEmpty(CurrentUser.Text))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <UserInfo> request = new PostRequest <UserInfo>();
                    b.password     = EncryptionHelper.encrypt(b.password);
                    request.entity = b;
                    PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request);

                    if (!r.Success)
                    //check if the insert failed
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    b.recordId = r.recordId;
                    //elias
                    AccountRecoveryRequest req = new AccountRecoveryRequest();
                    req.Email = b.email;
                    //PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(req);
                    //if (!response.Success)

                    //{
                    //    //Show an error saving...
                    //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    //     Common.errorMessage(response);
                    //    return;
                    //}
                    //else
                    //{

                    //Add this record to the store
                    Store1.Reload();
                    CurrentUser.Text    = r.recordId;
                    userGroups.Disabled = false;
                    //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 <UserInfo> request = new PostRequest <UserInfo>();



                    request.entity = b;
                    PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(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();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }