Ejemplo n.º 1
0
 public static SectionEntity AddSection(this FormEntity form, SectionEntity section)
 {
     section.Form   = form;
     section.FormId = form.Id;
     form.Sections.Add(section);
     return(section);
 }
Ejemplo n.º 2
0
 public Form(FormEntity FormEntity) : base(FormEntity)
 {
     if (FormEntity.StudentClass != null)
     {
         this.StudentClass = new StudentClass(FormEntity.StudentClass);
     }
 }
Ejemplo n.º 3
0
        public override void AddNewParticular()
        {
            int        count = 0;
            FormEntity obj   = new FormEntity();

            //obj.InvoiceNo = this.InvoiceNo;
            //obj.InvoiceDate = this.InvoiceDate;
            //obj.SupplierID = this.SelectedSuppliers.StaticID.ToString();
            obj.ProductName  = this.SelectedProduct.ProductName;
            obj.ProductId    = this.SelectedProduct.ProductId;
            obj.Quantity     = this.Quantity;
            obj.Rate         = this.Rate;
            obj.Per          = this.SelectedPer.StaticID.ToString();
            obj.PerName      = this.SelectedPer.StaticName;
            obj.Amount       = this.Amount;
            obj.OtherCharges = this.OtherCharges;

            obj.TaxableAmount = this.TaxableAmount;
            obj.Comment       = this.Comment;
            obj.HSNCode       = this.HSNCode;
            obj.CGST          = this.CGST;
            obj.IGST          = this.IGST;
            obj.SGST          = this.SGST;
            obj.TotalTax      = this.TotalTax;
            obj.TotalAmount   = this.TotalAmount;


            OnAddedItem(obj);
            ClearAddedItems();


            //FormEntityModel.lstParticulars.Add(obj);
            //CalculateTotalofTotal();
        }
Ejemplo n.º 4
0
        public void SearchPayments(string invoiceID)
        {
            List <string> lst = new List <string>();

            lst.Add(invoiceID);
            string sql = "exec IMS.GetPaymentDetails";

            SearchResult = DAL.Select(sql, lst);
            if (SearchResult == null || SearchResult.Rows.Count == 0)
            {
                return;
            }
            if (lstPaymentDetail == null)
            {
                lstPaymentDetail = new ObservableCollection <FormEntity>();
            }
            lstPaymentDetail.Clear();
            foreach (DataRow dr in SearchResult.Rows)
            {
                FormEntity obj = new FormEntity();

                obj.PaymentAmount = Convert.ToDouble(dr["PaymentAmount"]);
                obj.PaymentDate   = Convert.ToDateTime(dr["PaymentDate"]);
                obj.PaymentMode   = dr["PaymentMode"].ToString();
                obj.PaymentModeId = dr["PaymentModeId"].ToString();
                obj.PaymentType   = dr["PaymentType"].ToString();
                obj.PaymentTypeId = dr["PaymentTypeId"].ToString();
                obj.Comment1      = dr["Comment1"].ToString();
                lstPaymentDetail.Add(obj);
                CalculateTotalPaidAmount();
            }
        }
Ejemplo n.º 5
0
 static void ShowEntityAssemblyConfig()
 {
     try
     {
         FormEntity <MessageEntityConfigEntryAttribute, IMessageEntityConfig> frm = new FormEntity <MessageEntityConfigEntryAttribute, IMessageEntityConfig>(Log, true);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             EntityAssemblyConfig e = frm.Entity;
             if (e != null)
             {
                 ConfigMgt.Config.EntityAssembly = e;
                 if (ConfigMgt.Save())
                 {
                     Log.Write("Save config file succeeded. " + ConfigMgt.FileName);
                 }
                 else
                 {
                     Log.Write(LogType.Error, "Save config file failed. " + ConfigMgt.FileName);
                     Log.Write(ConfigMgt.LastError);
                 }
             }
         }
     }
     catch (Exception err)
     {
         Log.Write(err);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the data for the contact section in the home page.
        /// </summary>
        /// <returns>contact model containing the data for the contact section in the home page.</returns>
        public HomeEntity GetContactSectionData()
        {
            ContactEntity contactEntity = this.homeEntityFactory.GetContactEntity() as ContactEntity;

            contactEntity.Id   = "contact";
            contactEntity.Name = "Contact Me";
            List <FieldEntity> fields    = new List <FieldEntity>();
            FieldEntity        nameField = this.formEntityFactory.GetFieldEntity() as FieldEntity;

            nameField.Id                = "name";
            nameField.Name              = "Name";
            nameField.InputType         = "text";
            nameField.FieldType         = "input";
            nameField.PlaceHolder       = "Name";
            nameField.IsRequired        = true;
            nameField.ValidationMessage = "Please enter your name.";
            FieldEntity emailField = this.formEntityFactory.GetFieldEntity() as FieldEntity;

            emailField.Id                = "email";
            emailField.Name              = "Email Address";
            emailField.FieldType         = "input";
            emailField.InputType         = "email";
            emailField.PlaceHolder       = "Email Address";
            emailField.IsRequired        = true;
            emailField.ValidationMessage = "Please enter your email address.";
            FieldEntity phoneField = this.formEntityFactory.GetFieldEntity() as FieldEntity;

            phoneField.Id                = "phone";
            phoneField.Name              = "Phone Number";
            phoneField.FieldType         = "input";
            phoneField.InputType         = "tel";
            phoneField.PlaceHolder       = "Phone Number";
            phoneField.IsRequired        = true;
            phoneField.ValidationMessage = "Please enter your phone number.";
            FieldEntity messageField = this.formEntityFactory.GetFieldEntity() as FieldEntity;

            messageField.Id                = "message";
            messageField.Name              = "Message";
            messageField.FieldType         = "textarea";
            messageField.PlaceHolder       = "Message";
            messageField.IsRequired        = true;
            messageField.ValidationMessage = "Please enter a message.";
            fields.Add(nameField);
            fields.Add(emailField);
            fields.Add(phoneField);
            fields.Add(messageField);
            List <FormMetaEntity> formMetas   = new List <FormMetaEntity>();
            FormMetaEntity        rowFormMeta = this.formEntityFactory.GetFormMetaEntity() as FormMetaEntity;

            rowFormMeta.Type  = "row";
            rowFormMeta.Value = "5";
            formMetas.Add(rowFormMeta);
            messageField.FieldMetaList = formMetas;
            FormEntity contactFormEntity = this.formEntityFactory.GetFormEntity() as FormEntity;

            contactFormEntity.Fields  = fields;
            contactEntity.ContactForm = contactFormEntity;
            return(contactEntity);
        }
Ejemplo n.º 7
0
 public override void RemoveParticular(FormEntity o)
 {
     if (lstParticulars == null)
     {
         return;
     }
     lstParticulars.Remove(o);
     CalculateTotalofTotal();
 }
Ejemplo n.º 8
0
 private void OnPaymentAddedItem(FormEntity o)
 {
     if (lstPaymentDetail == null)
     {
         lstPaymentDetail = new ObservableCollection <FormEntity>();
     }
     lstPaymentDetail.Add(o);
     CalculateTotalPaidAmount();
 }
Ejemplo n.º 9
0
 void objv_OnAddedItem(FormEntity o)
 {
     if (lstParticulars == null)
     {
         lstParticulars = new ObservableCollection <FormEntity>();
     }
     lstParticulars.Add(o);
     CalculateTotalofTotal();
 }
Ejemplo n.º 10
0
        public override void Search(string invoiceID)
        {
            List <string> lst = new List <string>();

            lst.Add(invoiceID);
            lst.Add(string.Empty);
            lst.Add(string.Empty);
            lst.Add(string.Empty);
            string sql = "exec [IMS].[GetBillDetails]";

            SearchResult = DAL.Select(sql, lst);
            if (SearchResult == null || SearchResult.Rows.Count == 0)
            {
                return;
            }
            if (lstParticulars == null)
            {
                lstParticulars = new ObservableCollection <FormEntity>();
            }
            lstParticulars.Clear();
            this.IUDFlag      = "U";
            this.BillId       = SearchResult.Rows[0]["BillID"].ToString();
            this.BillNo       = SearchResult.Rows[0]["BillNo"].ToString();
            this.BillDate     = Convert.ToDateTime(SearchResult.Rows[0]["BillDate"]);
            this.Discount     = Convert.ToDouble(SearchResult.Rows[0]["Discount"]);
            this.CustomerName = SearchResult.Rows[0]["CustomerDetail"].ToString();

            foreach (DataRow dr in SearchResult.Rows)
            {
                FormEntity obj = new FormEntity();

                obj.ProductName = dr["Product"].ToString();;
                obj.ProductId   = dr["ProductId"].ToString();;

                obj.Quantity = dr["Quantity"].ToString();
                obj.Rate     = dr["Rate"].ToString();

                obj.Per     = dr["Per"].ToString();
                obj.PerName = dr["PerName"].ToString();

                obj.Amount       = Convert.ToDouble(dr["Amount"]);
                obj.OtherCharges = Convert.ToDouble(dr["OtherCharges"]);

                obj.TaxableAmount = Convert.ToDouble(dr["TaxableAmount"]);
                //                obj.Comment = (dr["Comments"].ToString());
                obj.HSNCode     = (dr["HSNCode"].ToString());
                obj.CGST        = Convert.ToDouble(dr["CGST"]);
                obj.IGST        = Convert.ToDouble(dr["IGST"]);
                obj.SGST        = Convert.ToDouble(dr["SGST"]);
                obj.TotalTax    = Convert.ToDouble(dr["TotalTax"]);
                obj.TotalAmount = Convert.ToDouble(dr["TotalAmount"]);

                lstParticulars.Add(obj);
                CalculateTotalofTotal();
            }
            //            SearchPayments(this.InvoiceID);
        }
Ejemplo n.º 11
0
 public static FormEntity MapSections(this FormEntity form)
 {
     form.Sections.ForEach(section =>
     {
         section.FormId = form.Id;
         section.Form   = form;
     });
     return(form);
 }
Ejemplo n.º 12
0
        public Form getFormById(string id)
        {
            FormEntity formEntity = _formsRepository.Get(id);

            return(new Form
            {
                id = formEntity.id,
                title = formEntity.title
            });
        }
Ejemplo n.º 13
0
 public FormEntity Create(UserEntity userEntity, FormEntity FormEntity)
 {
     if (FormValidator(FormEntity))
     {
         Form Form = new Form(FormEntity);
         Form.Id = Guid.NewGuid();
         context.Forms.Add(Form);
         context.SaveChanges();
         return(new FormEntity(Form));
     }
     throw new BadRequestException("Cannot create!");
 }
Ejemplo n.º 14
0
        public void StartApply(string flowId, string key, List <WorkControlEntity> controls)
        {
            WorkEntity workEntity = new WorkEntity();

            if (flowId != null)
            {
                FlowEntity flowentity = flowApp.GetForm(flowId);
                if (flowentity != null && !string.IsNullOrEmpty(flowentity.Id))
                {
                    FormEntity        formEntity        = formApp.GetForm(flowentity.FormId);
                    FlowVersionEntity flowVersionEntity = flowApp.GetDesign(flowId);
                    if (flowentity != null && !string.IsNullOrEmpty(flowentity.Id) &&
                        formEntity != null && !string.IsNullOrEmpty(formEntity.Id) &&
                        flowVersionEntity != null && !string.IsNullOrEmpty(flowVersionEntity.Id))
                    {
                        workEntity.Create();
                        workEntity.FullName      = flowentity.FullName;
                        workEntity.FlowVersionId = flowVersionEntity.Id;
                        workEntity.FlowStatus    = (int)WorkStatus.Applying;
                        workEntity.Codes         = formEntity.Codes;
                        workEntity.Contents      = key;
                        var loguser = OperatorProvider.Provider.GetCurrent();
                        if (loguser != null)
                        {
                            workEntity.ApplyUserId = loguser.UserId;
                        }
                        service.AddForm(workEntity, controls, null);
                        try
                        {
                            workFlowApp.Start(workEntity.Id);
                        }
                        catch (Exception ex)
                        {
                            workEntity.FlowStatus = (int)WorkStatus.Save;
                            service.Update(workEntity);
                            throw ex;
                        }
                    }
                    else
                    {
                        throw new Exception("操作失败!");
                    }
                }
                else
                {
                    throw new Exception("操作失败!");
                }
            }
            else
            {
                throw new Exception("操作失败,提交状态无效!");
            }
        }
Ejemplo n.º 15
0
        public string GetFormDesign(string flowId)
        {
            string     strContents = string.Empty;
            FlowEntity flowEntity  = flowApp.GetForm(flowId);

            if (flowEntity != null && !string.IsNullOrEmpty(flowEntity.Id) && !string.IsNullOrEmpty(flowEntity.FormId))
            {
                FormEntity formEntity = formApp.GetForm(flowEntity.FormId);
                strContents = formEntity.Codes;
            }
            return(strContents);
        }
Ejemplo n.º 16
0
 public static bool UpdateForm(FormEntity formEntity)
 {
     OracleParameter[] sqlParam = new OracleParameter[6];
     sqlParam[0] = new OracleParameter("FormID", formEntity.FormID);
     sqlParam[1] = new OracleParameter("FormName", formEntity.FormName);
     sqlParam[2] = new OracleParameter("DictionaryID", formEntity.DictionaryID);
     //sqlParam[3] = new OracleParameter("UPDATE_DT", formEntity.UPDATE_DT);
     sqlParam[3] = new OracleParameter("UPDATE_UID", formEntity.UPDATE_UID);
     sqlParam[4] = new OracleParameter("FilePath", formEntity.FilePath);
     sqlParam[5] = new OracleParameter("ModuleID", formEntity.ModuleID);
     return(DBHelper.ExecuteNonQuery_SP("PKOPM_FORMANDMENU.sp_OPM_Form_Update", sqlParam));
 }
Ejemplo n.º 17
0
        public async Task <ActionResult> SubmitForm(FormEntity entity, string keyValue)
        {
            try
            {
                await _service.SubmitForm(entity, keyValue);

                return(await Success("操作成功。", "", keyValue));
            }
            catch (Exception ex)
            {
                return(await Error(ex.Message, "", keyValue));
            }
        }
Ejemplo n.º 18
0
        public ActionResult createForm([DataSourceRequest] DataSourceRequest request, eForm _form)
        {
            FormEntity formEntity = new FormEntity();

            formEntity.FormID       = _form.FORM_CODE;
            formEntity.FormName     = _form.FORM_NAME;
            formEntity.DictionaryID = "";
            formEntity.CREATE_UID   = "hieuht";
            formEntity.FilePath     = _form.FILE_PATH;
            formEntity.ModuleID     = "";
            bool result = FormAccess.InsertForm(formEntity);

            return(Json(new[] { _form }.ToDataSourceResult(request, ModelState)));
        }
Ejemplo n.º 19
0
        public void SaveDesign(string keyValue, string codes, List <FormControlEntity> formControlModels)
        {
            FormEntity formEntity = GetForm(keyValue);

            if (formEntity != null && !string.IsNullOrEmpty(formEntity.Id))
            {
                formEntity.Codes = codes;
                service.SaveDesign(formEntity, formControlModels);
            }
            else
            {
                throw new Exception("获取数据异常!");
            }
        }
Ejemplo n.º 20
0
 public void SubmitForm(FormEntity formEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         formEntity.Modify(keyValue);
         service.Update(formEntity);
     }
     else
     {
         formEntity.EnabledMark = true;
         formEntity.Create();
         service.Insert(formEntity);
     }
 }
Ejemplo n.º 21
0
        public void DisabledForm(string keyValue)
        {
            FormEntity formEntity = GetForm(keyValue);

            if (formEntity != null && !string.IsNullOrEmpty(formEntity.Id))
            {
                formEntity.Modify(keyValue);
                formEntity.EnabledMark = false;
                service.Update(formEntity);
            }
            else
            {
                throw new Exception("获取数据异常!");
            }
        }
Ejemplo n.º 22
0
        public override void AddNewPayment()
        {
            FormEntity obj = new FormEntity();

            obj.PaymentType   = this.SelectedPaymentType.StaticName;
            obj.PaymentTypeId = this.SelectedPaymentType.StaticID.ToString();
            obj.PaymentMode   = this.SelectedPaymentMode.StaticName;
            obj.PaymentModeId = this.SelectedPaymentMode.StaticID.ToString();
            obj.PaymentDate   = this.PaymentDate;
            obj.PaymentAmount = this.PaymentAmount;
            obj.Comment1      = this.Comment1;
            OnAddedItem(obj);
            //lstPaymentDetail.Add(obj);
            //CalculateTotalPaidAmount();
            ClearPaymentItems();
        }
Ejemplo n.º 23
0
 public FormEntity Create(UserEntity userEntity, FormEntity FormEntity)
 {
     if (FormValidator(FormEntity))
     {
         if (context.Forms.FirstOrDefault(f => f.StudentClassId == FormEntity.StudentClassId) != null)
         {
             throw new BadRequestException("Cannot create form");
         }
         Form Form = new Form(FormEntity);
         Form.Id = Guid.NewGuid();
         context.Forms.Add(Form);
         context.SaveChanges();
         return(new FormEntity(Form));
     }
     throw new BadRequestException("Cannot Create");
 }
Ejemplo n.º 24
0
 public FormEntity Update(UserEntity userEntity, Guid FormId, FormEntity FormEntity)
 {
     if (FormValidator(FormEntity))
     {
         Form Form = context.Forms.FirstOrDefault(c => c.Id == FormId);
         if (Form == null)
         {
             throw new NotFoundException("Form not found!");
         }
         Form updateForm = new Form(FormEntity);
         updateForm.CopyTo(Form);
         context.SaveChanges();
         return(new FormEntity(Form));
     }
     throw new BadRequestException("Cannot update!");
 }
Ejemplo n.º 25
0
 public static Form ToForm(this FormEntity form, IList <string> languages, bool addSections = true, bool addFields = false)
 {
     return(new Form
     {
         Id = form.Id,
         ProgramId = form.ProgramId,
         Label = form.Resource.ToLabel(languages),
         Labels = form.Resource.ToLabels(languages),
         Sections =
             addSections
             ? form.Sections
             .Where(s => s.DateDeleted == null)
             .OrderBy(s => s.DisplaySort)
             .Select(s => s.ToSection(languages, addFields))
             .ToList()
             : null
     });
 }
        private void GetInventoryDetails()
        {
            lstInventoryDetails = new ObservableCollection <FormEntity>();
            string    sql = "[IMS].[GetInventoryReport] " + Common.Clientid;
            DataTable dt  = DAL.Select(sql);

            //
            foreach (DataRow dr in dt.Rows)
            {
                FormEntity obj = new FormEntity();
                obj.ProductId   = dr["ProductID"].ToString();
                obj.ProductName = dr["ProductName"].ToString();
                obj.Quantity    = dr["Quantity"] == DBNull.Value ? "0.00" : Convert.ToDouble(dr["Quantity"]).ToString();
                obj.PerName     = dr["PerName"].ToString();

                lstInventoryDetails.Add(obj);
            }
        }
Ejemplo n.º 27
0
        public bool Delete(UserEntity userEntity, Guid FormId)
        {
            var CurrentForm = context.Forms.FirstOrDefault(c => c.Id == FormId);

            if (CurrentForm == null)
            {
                return(false);
            }
            FormEntity FormEntity = new FormEntity(CurrentForm);

            if (FormValidator(FormEntity))
            {
                context.Forms.Remove(CurrentForm);
                context.SaveChanges();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 28
0
        private void GetProduct()
        {
            lstProducts = new ObservableCollection <FormEntity>();
            DataTable dt = Common.GetProducts();

            foreach (DataRow dr in dt.Rows)
            {
                FormEntity obj = new FormEntity();
                obj.ClientId    = dr["clientid"].ToString();
                obj.ProductName = dr["ProductDetail"].ToString();
                obj.ProductId   = dr["productid"].ToString();
                obj.HSNCode     = dr["HSNCode"].ToString();
                obj.CGST        = dr["CGST"] == DBNull.Value ? 0.00 : Convert.ToDouble(dr["CGST"]);
                obj.IGST        = dr["IGST"] == DBNull.Value ? 0.00 : Convert.ToDouble(dr["IGST"]);
                obj.SGST        = dr["SGST"] == DBNull.Value ? 0.00 : Convert.ToDouble(dr["SGST"]);
                obj.Per         = dr["Per"].ToString();
                lstProducts.Add(obj);
            }
        }
Ejemplo n.º 29
0
        private bool FormValidator(FormEntity FormEntity)
        {
            StudentClass studentClass = context.StudentClasses.Where(sc => sc.Id == FormEntity.StudentClassId).FirstOrDefault();

            if (studentClass == null)
            {
                return(false);
            }
            Class Class = context.Classes.Where(c => c.Id == studentClass.ClassId).FirstOrDefault();

            if (Class == null)
            {
                return(false);
            }
            if (DateTime.Now >= Class.OpenedDate && DateTime.Now <= Class.ClosedDate)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 30
0
        async public Task <SubmissionEntity> submitForm(string formId, string host, JsonElement content)
        {
            FormEntity form = _formsRepository.Get(formId);

            // Check request host domain

            // Check recaptcha// TODO: Inject RecaptchaService as dependency
            var recaptchaService = new RecaptchaService(form.recaptchaSecret);
            var recaptchaToken   = content.GetProperty("g-recaptcha-response").GetString();
            var isCaptchaValid   = await recaptchaService.IsCaptchaValid(recaptchaToken);

            if (!isCaptchaValid)
            {
                throw new Exception("Recaptcha validation failed");
            }

            // Send email

            // Save submission
            return(null);
        }