Example #1
0
        public string GetPrimarySalesParameters()
        {
            StringBuilder strContent = new StringBuilder();

            try
            {
                DataControl.CurrentInfo objCurInfo = new CurrentInfo();
                DataControl.BLProduct   objProduct = new BLProduct();
                List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel> lstParam = new List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel>();
                lstParam = (List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel>)objProduct.GetAllPSParameters(objCurInfo.GetCompanyCode());
                strContent.Append("<table class='table table-striped'><thead><tr>");
                // strContent.Append("<td><input type='checkbox' name='chkSelectAll' onclick='fnSelectAll();' /> </td>");
                strContent.Append("<td>Edit</td><td>Change Staus</td><td>Parameter Name</td><td>Parameter Column Name</td><td>Status</td>");
                strContent.Append("</tr></thead>");

                if (lstParam.Count > 0)
                {
                    var lstParam1 = lstParam.AsEnumerable().Where(x => x.Record_Status == "1").ToList();
                    foreach (MVCModels.HiDoctor_Master.PrimarySalesParametersModel item in lstParam1)
                    {
                        strContent.Append("<tr>");
                        //<td><input type='checkbox' name='chkSelect' value='" + item.Parameter_Code + "' /> </td>");
                        strContent.Append("<td><a href='#' onclick='fnEditParam(\"" + item.Parameter_Code + "\",\""
                                          + item.Parameter_Name + "\",\"" + item.Param_Column_Name + "\",\""
                                          + item.Flag + "\");'>Edit</a></td>");
                        strContent.Append("<td><a href='#' onclick='fnChangeParamStatus(\""
                                          + item.Parameter_Code + "\",\"" + item.Record_Status + "\");'>Change Status</a></td>");
                        strContent.Append("<td>" + item.Parameter_Name + "</td>");
                        strContent.Append("<td>" + item.Param_Column_Name + "</td>");
                        if (item.Record_Status == "1")
                        {
                            strContent.Append("<td>Enabled</td>");
                        }
                        else
                        {
                            strContent.Append("<td>Disabled</td>");
                        }
                        strContent.Append("</tr>");
                    }

                    var lstParam2 = lstParam.AsEnumerable().Where(x => x.Record_Status == "0").ToList();
                    foreach (MVCModels.HiDoctor_Master.PrimarySalesParametersModel item in lstParam2)
                    {
                        strContent.Append("<tr>");
                        //<td><input type='checkbox' name='chkSelect' value='" + item.Parameter_Code + "' /> </td>");
                        strContent.Append("<td><a href='#' onclick='fnEditParam(\"" + item.Parameter_Code + "\",\""
                                          + item.Parameter_Name + "\",\"" + item.Param_Column_Name + "\",\""
                                          + item.Flag + "\");'>Edit</a></td>");
                        strContent.Append("<td><a href='#' onclick='fnChangeParamStatus(\""
                                          + item.Parameter_Code + "\",\"" + item.Record_Status + "\");'>Change Status</a></td>");
                        strContent.Append("<td>" + item.Parameter_Name + "</td>");
                        strContent.Append("<td>" + item.Param_Column_Name + "</td>");
                        if (item.Record_Status == "1")
                        {
                            strContent.Append("<td>Enabled</td>");
                        }
                        else
                        {
                            strContent.Append("<td>Disabled</td>");
                        }
                        strContent.Append("</tr>");
                    }
                }
                strContent.Append("</table>");
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicContext = new Dictionary <string, string>();
                DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext);
            }
            return(strContent.ToString());
        }
Example #2
0
        public string InsertPSParameter(string parameterName, string parameterCode, string mode, string status, string flag, string columnName)
        {
            string result = string.Empty;

            try
            {
                DataControl.CurrentInfo objCurInfo = new CurrentInfo();
                DataControl.BLProduct   objProduct = new BLProduct();

                List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel> lstCheckParam = new List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel>();
                lstCheckParam = (List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel>)objProduct.GetAllPSParameters(objCurInfo.GetCompanyCode());
                if ("INSERT" == mode.ToUpper())
                {
                    var fileterd = lstCheckParam.AsEnumerable().Where(z => z.Param_Column_Name.ToUpper() == columnName.ToUpper()).ToList();
                    if (fileterd.Count > 0)
                    {
                        result = "ERROR:Primary sales column name must be unique";
                    }
                }
                if ("EDIT" == mode.ToUpper())
                {
                    var fileterd = lstCheckParam.AsEnumerable().Where(z => z.Param_Column_Name.ToUpper() == columnName.ToUpper()).ToList();
                    if (fileterd.Count > 0)
                    {
                        if (fileterd[0].Parameter_Code != parameterCode)
                        {
                            result = "ERROR:Primary sales column name must be unique";
                        }
                    }
                }
                if (string.IsNullOrEmpty(result))
                {
                    int rowsAffected = 0;
                    List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel> lstParam = new List <MVCModels.HiDoctor_Master.PrimarySalesParametersModel>();
                    MVCModels.HiDoctor_Master.PrimarySalesParametersModel        objParam = new MVCModels.HiDoctor_Master.PrimarySalesParametersModel();
                    objParam.Parameter_Name    = parameterName;
                    objParam.Parameter_Code    = parameterCode;
                    objParam.Record_Status     = status;
                    objParam.Param_Column_Name = columnName;
                    objParam.Flag         = flag;
                    objParam.Company_Code = objCurInfo.GetCompanyCode();
                    lstParam.Add(objParam);
                    rowsAffected = objProduct.InsertPSParameters(objCurInfo.GetCompanyCode(), mode, lstParam);
                    if (rowsAffected > 0)
                    {
                        if (mode.ToUpper() == "INSERT")
                        {
                            result = "SUCCESS:Primary sales parameter added successfully";
                        }
                        else if (mode.ToUpper() == "EDIT")
                        {
                            result = "SUCCESS:Primary sales parameter updated successfully";
                        }
                        else
                        {
                            result = "SUCCESS:Primary sales parameter status chnaged successfully";
                        }
                    }
                    else
                    {
                        result = "ERROR:Primary sales parameter updation failed";
                    }
                }
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicContext = new Dictionary <string, string>();
                DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext);
            }
            return(result);
        }