public DataRow viewApplyDetail(string id)
    {
        CommonClass cc = new CommonClass();

        string cmdstr = "select * from ApplyList where id="+id;

        DataTable dt = cc.reDt(cmdstr);

        return dt.Rows[0];
    }
    public bool checkTime(string address,string date,string time )
    {
        CommonClass cc = new CommonClass();

        string cmdstr = "select count(*) from ApplyList where status='待审核' or status='审核通过' and applyAddress='" + address +
            "' and applyDate = '"+date+"' and applyTime = '"+time+"'";

        DataTable dt = cc.reDt(cmdstr);

        if (dt.Rows[0][0].ToString() == "0")
            return false;
        else
            return true;
    }
    /// <summary>
    ///企业提交宣讲会时间地点申请的函数
    /// </summary>
    public int submitMessage(string companyName,string companyCode,string companyAddress,string companyContacts,
        string companyDeparture,string companyEmail,string companyPhone,string companyMoble,string companyTax,
        string agentContacts,string agentName,string agentEmail,string agentPhone,string agentMobile,string applyAddress,
        string applyDate,string applyTime,string applier)
    {
        CommonClass cc = new CommonClass();

        string cmdstr =
            "insert into ApplyList values('"+companyName+"','"+companyCode+"','"+companyAddress+
            "','" + companyContacts + "','" + companyDeparture + "','" + companyEmail + "','"+companyPhone+
            "','"+companyMoble+"','"+companyTax+"','"+agentContacts+"','"+agentName+
            "','"+agentEmail+"','"+agentPhone+"','"+agentMobile+"','"+applyAddress+
            "','"+applyDate+"','"+applyTime+"',NULL,NULL,NULL,NULL,NULL,NULL,'"+applier+"','"+DateTime.Now.ToString()+"','待审核')";

        return cc.sqlEx(cmdstr);
    }
 private void LeaveEvent(object sender, EventArgs e)
 {
     CommonClass.LeaveEvents(sender, e);
 }
Exemple #5
0
        private void FormBegin_Load(object sender, EventArgs e)
        {
            CommonClass common = new CommonClass();

            this.textBox1.Text = common.GetConfigValue("SAVEDIR");
        }
Exemple #6
0
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     objCommonClass          = null;
     objwscCustomerComplaint = null;
 }
 private void txt_KeyPress(object sender, KeyPressEventArgs e)
 {
     CommonClass.KeyPressEvents(sender, e);
 }
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     objCommonClass  = null;
     objBranchMaster = null;
 }
Exemple #9
0
    //保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_System_Dictionary model = new TB_System_Dictionary();

        if (ViewState["id"] != null)
        {
            model = SystemService.DictionaryService.Get(ViewState["id"]);
            if (model.Code != TbCode.Text.TrimEnd())
            {
                List <Expression> express = new List <Expression>();
                express.Add(new Expression("Code", "=", TbCode.Text.TrimEnd()));
                express.Add(new Expression("TypeCode", "=", model.TypeCode));
                var list = SystemService.DictionaryService.Search(express);
                if (list.Count > 0)
                {
                    MessageDiv.InnerHtml = CommonClass.Alert("当前标识已存在,请重新输入");
                    return;
                }
            }
        }
        else
        {
            List <Expression> express = new List <Expression>();
            express.Add(new Expression("Code", "=", TbCode.Text.TrimEnd()));
            express.Add(new Expression("TypeCode", "=", DDLModel.SelectedValue));
            var list = SystemService.DictionaryService.Search(express);
            if (list.Count > 0)
            {
                MessageDiv.InnerHtml = CommonClass.Alert("当前标识已存在,请重新输入");
                return;
            }
        }

        model.TypeCode = DDLModel.SelectedValue;
        model.Name     = TbName.Text.Trim();
        model.Code     = TbCode.Text;
        model.Remark   = TbRemark.Text;
        model.OrderBy  = TbOrderBy.Text.ToInt();
        model.Creater  = AdminUserName;
        model.AddDate  = DateTime.Now;
        ISystem_Dictionary Dictionary = SystemService.DictionaryService;

        if (ViewState["id"] == null)
        {
            if (Dictionary.Insert(model) == 1)
            {
                CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllDictionaries.ToStr());
                MessageDiv.InnerHtml = CommonClass.Reload("数据添加成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败");
            }
        }
        else
        {
            if (Dictionary.Update(model) == 1)
            {
                CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllDictionaries.ToStr());
                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败");
            }
        }
    }
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     objCommonClass         = null;
     objWSCEscalationMatrix = null;
 }
Exemple #11
0
    protected void imgBtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            string strMessage = "";
            string strTerDesc = "";
            int    routingSno = 0;
            int    intCounter = 0;
            objRoutingMaster.CreatedDate = DateTime.Now.ToString();
            if (lstbxProductDiv.Items.Count == 0)
            {
                #region for single product division
                foreach (GridViewRow grv in gvTerritory.Rows)
                {
                    if (((CheckBox)grv.FindControl("chkChild")).Checked == true)
                    {
                        intCounter = intCounter + 1;
                        //Assigning values to properties
                        objRoutingMaster.RoutingSno     = 0;
                        objRoutingMaster.UnitSNo        = int.Parse(ddlProductDivision.SelectedValue.ToString());
                        objRoutingMaster.ProductLineSno = int.Parse(ddlProductLine.SelectedValue.ToString());
                        objRoutingMaster.SCSNo          = int.Parse(ddlSC.SelectedValue.ToString());
                        objRoutingMaster.StateSNo       = int.Parse(ddlState.SelectedValue.ToString());
                        objRoutingMaster.CitySNo        = int.Parse(ddlCity.SelectedValue.ToString());
                        strTerDesc = ((Label)grv.FindControl("lblTerritory_Desc")).Text;

                        HiddenField hndTerritorySno = (HiddenField)grv.FindControl("hdnTerritorySno");
                        objRoutingMaster.TerritorySNo = int.Parse(hndTerritorySno.Value.ToString());
                        // Comment by Mukesh Kumar as on 25.May.15
                        //Label lblPPreference = (Label)grv.FindControl("lblPreference");
                        //objRoutingMaster.Preference = lblPPreference.Text.Trim();
                        //Label lblSpecialRemarks = (Label)grv.FindControl("lblSpecialRemarks");
                        //objRoutingMaster.SpecialRemarks = lblSpecialRemarks.Text.Trim();

                        objRoutingMaster.Preference     = "0";   // Added by Mukesh Kumar as on 25.May.15
                        objRoutingMaster.SpecialRemarks = "";    // Added by Mukesh Kumar as on 25.May.15

                        objRoutingMaster.EmpCode    = Membership.GetUser().UserName.ToString();
                        objRoutingMaster.ActiveFlag = rdoStatus.SelectedValue.ToString();
                        //Calling SaveData to save Routing details information
                        //and pass SP Type "INSERT_ROUTING" it "return"
                        //if record is not already exist otherwise exists
                        string strMsg = objRoutingMaster.SaveData("INSERT_ROUTING");
                        routingSno = objRoutingMaster.ReturnRoutingSno;
                        if (objRoutingMaster.ReturnValue == -1)
                        {
                            lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.ErrorInStoreProc, enuMessageType.Error, false, "");
                        }
                        else
                        {
                            if (strMsg == "Exists")
                            {
                                strMessage = strMessage + strTerDesc + ",";
                            }
                            else
                            {
                                lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.AddRecord, enuMessageType.UserMessage, false, "");
                            }
                        }
                    }
                }
                //if (routingSno > 0)
                //    sendDBMail(routingSno); Commented on 9.9.14 after CG Approval
                #endregion for single product division
            }
            else
            {
                #region for multiple product division
                for (int i = 0; i < lstbxProductDiv.Items.Count; i++)
                {
                    foreach (GridViewRow grv in gvTerritory.Rows)
                    {
                        if (((CheckBox)grv.FindControl("chkChild")).Checked == true)
                        {
                            intCounter = intCounter + 1;
                            //Assigning values to properties
                            objRoutingMaster.RoutingSno     = 0;
                            objRoutingMaster.UnitSNo        = int.Parse(lstbxProductDiv.Items[i].Value.ToString());
                            objRoutingMaster.ProductLineSno = int.Parse(ddlProductLine.SelectedValue.ToString());
                            objRoutingMaster.SCSNo          = int.Parse(ddlSC.SelectedValue.ToString());
                            objRoutingMaster.StateSNo       = int.Parse(ddlState.SelectedValue.ToString());
                            objRoutingMaster.CitySNo        = int.Parse(ddlCity.SelectedValue.ToString());
                            strTerDesc = ((Label)grv.FindControl("lblTerritory_Desc")).Text;

                            HiddenField hndTerritorySno = (HiddenField)grv.FindControl("hdnTerritorySno");
                            objRoutingMaster.TerritorySNo = int.Parse(hndTerritorySno.Value.ToString());

                            // Comment by Mukesh Kumar as on 25.May.15
                            //Label lblPPreference = (Label)grv.FindControl("lblPreference");
                            //objRoutingMaster.Preference = lblPPreference.Text.Trim();
                            //Label lblSpecialRemarks = (Label)grv.FindControl("lblSpecialRemarks");
                            //objRoutingMaster.SpecialRemarks = lblSpecialRemarks.Text.Trim();
                            objRoutingMaster.Preference     = "0";   // Added by Mukesh Kumar as on 25.May.15
                            objRoutingMaster.SpecialRemarks = "";    // Added by Mukesh Kumar as on 25.May.15

                            objRoutingMaster.EmpCode    = Membership.GetUser().UserName.ToString();
                            objRoutingMaster.ActiveFlag = rdoStatus.SelectedValue.ToString();
                            //Calling SaveData to save Routing details information
                            //and pass SP Type "INSERT_ROUTING" it "return"
                            //if record is not already exist otherwise exists
                            string strMsg = objRoutingMaster.SaveData("INSERT_ROUTING");
                            routingSno = objRoutingMaster.ReturnRoutingSno;
                            if (objRoutingMaster.ReturnValue == -1)
                            {
                                lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.ErrorInStoreProc, enuMessageType.Error, false, "");
                            }
                            else
                            {
                                if (strMsg == "Exists")
                                {
                                    strMessage = strMessage + strTerDesc + ",";
                                }
                                else
                                {
                                    lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.AddRecord, enuMessageType.UserMessage, false, "");
                                }
                            }
                        }
                    }
                    //if (routingSno > 0)
                    //    sendDBMail(routingSno); Commented on 9.9.14 after CG Approval
                }

                #endregion for multiple product division
            }
            if (strMessage != "")
            {
                strMessage      = strMessage.TrimEnd(',');
                lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.DulplicateRecord, enuMessageType.UserMessage, true, " Following territory already assign to  " + ddlSC.SelectedItem.Text + " (" + strMessage + " )");
            }
            if (intCounter == 0)
            {
                lblMessage.Text = "Please select at-least one row for rout mapping.";
            }
        }
        catch (Exception ex)
        {
            CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
        bindGrid(1, true, "SC_Name");
        ClearControls();
    }
Exemple #12
0
        private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (this.checkBoxCheckMain.Checked)
                {
                    TreeListNode node = this.treeList1.FocusedNode;
                    if (!node.HasChildren && node["ERROR"].ToString() != "0" && node["ISCHECK"].ToString() == "已检查")
                    {
                        string        NAME          = node["NAME"].ToString();
                        string        CHECKTYPE     = node["CHECKTYPE"].ToString();
                        string        FIELD         = node["FIELD"].ToString();
                        string        TABLENAME     = node["TABLENAME"].ToString();
                        string        SUPTABLE      = node["SUPTABLE"].ToString();
                        string        SELECT        = node["SELECT"].ToString();
                        string        WHERESTRING   = node["WHERESTRING"].ToString();
                        string        RESULT        = node["RESULT"].ToString();
                        string        DOMAINTYPE    = node["DOMAINTYPE"].ToString();
                        string        SHOWFIELD     = node["SHOWFIELD"].ToString();
                        DataTable     dt            = new DataTable();
                        CommonClass   conClass      = new CommonClass();
                        ICursor       pFeatureCuror = null;
                        IFeatureLayer pFLayer       = conClass.GetLayerByName(TABLENAME);
                        IFeatureClass pFeatureClass = pFLayer.FeatureClass;
                        ITable        pTable        = pFeatureClass as ITable;
                        ConnectDB     db            = new ConnectDB();
                        if (CHECKTYPE == "空值检查")
                        {
                            IQueryFilter pQuery = new QueryFilterClass();
                            pQuery.WhereClause = FIELD + " IS NULL OR  format(" + FIELD + ") = '' ";
                            pFeatureCuror      = pTable.Search(pQuery, false);
                        }
                        else if (CHECKTYPE == "逻辑关系检查")
                        {
                            IQueryFilter pQuery = new QueryFilterClass();
                            pQuery.WhereClause = " (" + WHERESTRING + ") and (" + RESULT + ")";
                            pFeatureCuror      = pTable.Search(pQuery, false);
                        }
                        else if (CHECKTYPE == "唯一值检查")
                        {
                            IQueryFilter pQuery = new QueryFilterClass();
                            pQuery.WhereClause = FIELD + " in ( select " + FIELD + " as wyz from  " + TABLENAME + " group by " + FIELD + " having count(" + FIELD + ")>1)";
                            pFeatureCuror      = pTable.Search(pQuery, false);
                        }
                        else if (CHECKTYPE == "项目名称检查")
                        {
                            string[]    arrStr       = FIELD.Split('#');
                            string      fieldStr     = arrStr[0];
                            string      taskfieldStr = "CONCAT(" + arrStr[1].Replace("&", ",") + ")";
                            CommonClass common       = new CommonClass();
                            string      gldwstr      = common.GetConfigValue("GLDW");
                            DataTable   xmmcArr      = db.GetDataBySql("SELECT " + taskfieldStr + " AS XMMCARR FROM GISDATA_TASK WHERE YZLGLDW ='" + gldwstr + "'");
                            string[]    idInts       = xmmcArr.AsEnumerable().Select(d => d.Field <string>("XMMCARR")).ToArray();
                            string      codesString  = String.Join("','", idInts);

                            IQueryFilter pQuery = new QueryFilterClass();
                            pQuery.WhereClause = fieldStr + " not in ('" + codesString + "')";
                            pFeatureCuror      = pTable.Search(pQuery, false);
                        }
                        else if (CHECKTYPE == "值域检查")
                        {
                            if (DOMAINTYPE == "own")
                            {
                                DataTable dt1             = db.GetDataBySql("SELECT CODE_PK,CODE_WHERE FROM GISDATA_MATEDATA WHERE REG_NAME = '" + TABLENAME + "' AND FIELD_NAME = '" + FIELD + "'");
                                string    CODETABLENAME   = dt1.Rows[0]["CODE_PK"].ToString();
                                string    CODEWHERESTRING = dt1.Rows[0]["CODE_WHERE"].ToString();
                                DataTable codeArr         = null;
                                if (CODETABLENAME == "GISDATA_ZQSJZD")
                                {
                                    CommonClass common  = new CommonClass();
                                    string      gldwstr = common.GetConfigValue("GLDW");
                                    codeArr = db.GetDataBySql("SELECT C_CODE FROM " + CODETABLENAME + " WHERE " + CODEWHERESTRING + " AND LEFT(C_CODE,6)='" + gldwstr + "'");
                                }
                                else
                                {
                                    codeArr = db.GetDataBySql("SELECT C_CODE FROM " + CODETABLENAME + " WHERE " + CODEWHERESTRING);
                                }
                                string[] idInts      = codeArr.AsEnumerable().Select(d => d.Field <string>("C_CODE")).ToArray();
                                string   codesString = String.Join("','", idInts);

                                IQueryFilter pQuery = new QueryFilterClass();
                                //pQuery.WhereClause = FIELD + " not in (SELECT C_CODE FROM " + CODETABLENAME + " WHERE " + CODEWHERESTRING + ")";
                                pQuery.WhereClause = FIELD + " IS NOT NULL AND " + FIELD + " <> '' AND " + FIELD + " not in ('" + codesString + "')";
                                pFeatureCuror      = pTable.Search(pQuery, false);
                            }
                            else if (DOMAINTYPE == "custom")
                            {
                                string       CUSTOMVALUE = node["CUSTOMVALUE"].ToString();
                                IQueryFilter pQuery      = new QueryFilterClass();
                                pQuery.WhereClause = FIELD + " not in (" + CUSTOMVALUE + ") AND " + FIELD + " IS NOT NULL AND " + FIELD + " <> ''";
                                pFeatureCuror      = pTable.Search(pQuery, false);
                            }
                        }
                        if (pFeatureClass == null)
                        {
                            return;
                        }

                        DataColumn dc = null;
                        for (int i = 0; i < pFeatureClass.Fields.FieldCount; i++)
                        {
                            IField field = pFeatureClass.Fields.get_Field(i);
                            dc         = new DataColumn(field.Name);
                            dc.Caption = field.AliasName;
                            dt.Columns.Add(dc);
                            if (SHOWFIELD.Contains(field.Name))
                            {
                                dc.SetOrdinal(0);
                            }
                        }

                        ITable  iTable   = pFeatureClass as ITable;
                        IRow    pFeature = pFeatureCuror.NextRow();
                        DataRow dr       = null;
                        while (pFeature != null)
                        {
                            dr = dt.NewRow();
                            int colIndex = 0;
                            foreach (DataColumn itemColumns in dt.Columns)
                            {
                                int index = pFeatureClass.FindField(itemColumns.ColumnName);
                                if (pFeatureClass.FindField(pFeatureClass.ShapeFieldName) == index)
                                {
                                    dr[colIndex] = pFeatureClass.ShapeType.ToString();
                                }
                                else
                                {
                                    dr[colIndex] = pFeature.get_Value(index).ToString();
                                }
                                colIndex++;
                            }
                            dt.Rows.Add(dr);
                            pFeature = pFeatureCuror.NextRow();
                        }
                        GridView gridView = this.gridControlError.DefaultView as GridView;
                        gridView.Columns.Clear();
                        this.gridControlError.DataSource      = dt;
                        gridView.OptionsBehavior.Editable     = false;
                        gridView.OptionsSelection.MultiSelect = true;
                        gridView.ScrollStyle                 = ScrollStyleFlags.LiveHorzScroll | ScrollStyleFlags.LiveVertScroll;
                        gridView.HorzScrollVisibility        = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always;
                        gridView.OptionsView.ColumnAutoWidth = false;

                        gridView.ViewCaption    = "属性检查";
                        gridView.NewItemRowText = TABLENAME;
                        this.gridControlError.RefreshDataSource();
                        Marshal.ReleaseComObject(pFeatureCuror);
                        Marshal.ReleaseComObject(pFLayer);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(FormAttrDia), ex);
            }
        }
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     objCommonClass = null;
     objCapacitor   = null;
 }
Exemple #14
0
        public void loopCheck(TreeListNodes selectNode, XmlElement Attrs, XmlDocument doc)
        {
            foreach (TreeListNode node in selectNode)
            {
                //this.progressBar.Value = Convert.ToInt32((node.Id+1)/this.treeList1.AllNodesCount*100);
                DataRowView nodeData = this.treeList1.GetDataRecordByNode(node) as DataRowView;
                node.Expanded       = true;
                nodeData["ERROR"]   = "";
                nodeData["ISCHECK"] = "";
                if (node.Checked || node.CheckState == System.Windows.Forms.CheckState.Indeterminate)
                {
                    if (!node.HasChildren)
                    {
                        this.treeList1.FocusedNode = node;
                        string NAME = nodeData["NAME"].ToString();
                        Console.WriteLine(NAME);
                        string    CHECKTYPE   = nodeData["CHECKTYPE"].ToString();
                        string    FIELD       = nodeData["FIELD"].ToString();
                        string    TABLENAME   = nodeData["TABLENAME"].ToString();
                        string    SUPTABLE    = nodeData["SUPTABLE"].ToString();
                        string    SELECT      = nodeData["SELECT"].ToString();
                        string    WHERESTRING = nodeData["WHERESTRING"].ToString();
                        string    RESULT      = nodeData["RESULT"].ToString();
                        string    DOMAINTYPE  = nodeData["DOMAINTYPE"].ToString();
                        ConnectDB db          = new ConnectDB();
                        if (CHECKTYPE == "空值检查")
                        {
                            try{
                                CommonClass       conClass  = new CommonClass();
                                IFeatureWorkspace ifw       = conClass.GetFeatureWorkspaceByName(TABLENAME);
                                IQueryDef         pQueryDef = ifw.CreateQueryDef();
                                pQueryDef.Tables      = TABLENAME;
                                pQueryDef.SubFields   = "count(*) as errorCount";
                                pQueryDef.WhereClause = FIELD + " IS NULL OR  format(" + FIELD + ") = '' ";
                                ICursor pCur  = pQueryDef.Evaluate();
                                IRow    pRow  = pCur.NextRow();
                                int     iInx  = pCur.Fields.FindField("errorCount");
                                string  count = pRow.get_Value(iInx).ToString();
                                if (int.Parse(count) > 0)
                                {
                                    List <string> listItem = new List <string>();
                                    listItem.Add(CHECKTYPE);
                                    listItem.Add(NAME);
                                    listItem.Add(count);
                                    listItem.Add(FIELD + " IS NULL OR  format(" + FIELD + ") = '' ");
                                    this.listError.Add(listItem);
                                }
                                nodeData["ERROR"]   = count;
                                nodeData["ISCHECK"] = "已检查";
                                Marshal.ReleaseComObject(pCur);
                            }
                            catch (Exception e)
                            {
                                LogHelper.WriteLog(typeof(FormAttrDia), e);
                                LogHelper.WriteLog(typeof(FormAttrDia), FIELD + " IS NULL OR  format(" + FIELD + ") = '' ");
                            }
                        }
                        else if (CHECKTYPE == "逻辑关系检查")
                        {
                            if (WHERESTRING == "" || RESULT == "")
                            {
                                nodeData["ERROR"]   = "";
                                nodeData["ISCHECK"] = "未检查";
                            }
                            else
                            {
                                try
                                {
                                    CommonClass       conClass  = new CommonClass();
                                    IFeatureWorkspace ifw       = conClass.GetFeatureWorkspaceByName(TABLENAME);
                                    IQueryDef         pQueryDef = ifw.CreateQueryDef();
                                    pQueryDef.Tables      = TABLENAME;
                                    pQueryDef.SubFields   = "count(*) as errorCount";
                                    pQueryDef.WhereClause = " (" + WHERESTRING + ") and (" + RESULT + ")";
                                    ICursor pCur  = pQueryDef.Evaluate();
                                    IRow    pRow  = pCur.NextRow();
                                    int     iInx  = pCur.Fields.FindField("errorCount");
                                    string  count = pRow.get_Value(iInx).ToString();
                                    if (int.Parse(count) > 0)
                                    {
                                        List <string> listItem = new List <string>();
                                        listItem.Add(CHECKTYPE);
                                        listItem.Add(NAME);
                                        listItem.Add(count);
                                        listItem.Add(" (" + WHERESTRING + ") and (" + RESULT + ")");
                                        this.listError.Add(listItem);
                                    }
                                    nodeData["ERROR"]   = count;
                                    nodeData["ISCHECK"] = "已检查";
                                    Marshal.ReleaseComObject(pCur);
                                }catch (Exception e)
                                {
                                    LogHelper.WriteLog(typeof(FormAttrDia), e);
                                    LogHelper.WriteLog(typeof(FormAttrDia), " (" + WHERESTRING + ") and (" + RESULT + ")");
                                }
                            }
                        }
                        else if (CHECKTYPE == "唯一值检查")
                        {
                            try{
                                CommonClass       conClass  = new CommonClass();
                                IFeatureWorkspace ifw       = conClass.GetFeatureWorkspaceByName(TABLENAME);
                                IQueryDef         pQueryDef = ifw.CreateQueryDef();
                                pQueryDef.Tables      = TABLENAME;
                                pQueryDef.SubFields   = "count(*) as errorCount";
                                pQueryDef.WhereClause = FIELD + " in ( select " + FIELD + " as wyz from  " + TABLENAME + " group by " + FIELD + " having count(" + FIELD + ")>1)";
                                ICursor pCur  = pQueryDef.Evaluate();
                                IRow    pRow  = pCur.NextRow();
                                int     iInx  = pCur.Fields.FindField("errorCount");
                                string  count = pRow.get_Value(iInx).ToString();
                                if (int.Parse(count) > 0)
                                {
                                    List <string> listItem = new List <string>();
                                    listItem.Add(CHECKTYPE);
                                    listItem.Add(NAME);
                                    listItem.Add(count);
                                    listItem.Add(FIELD + " in ( select " + FIELD + " as wyz from  " + TABLENAME + " group by " + FIELD + " having count(" + FIELD + ")>1)");
                                    this.listError.Add(listItem);
                                }
                                nodeData["ERROR"]   = count;
                                nodeData["ISCHECK"] = "已检查";
                                Marshal.ReleaseComObject(pCur);
                            }
                            catch (Exception e)
                            {
                                LogHelper.WriteLog(typeof(FormAttrDia), e);
                                LogHelper.WriteLog(typeof(FormAttrDia), FIELD + " in ( select " + FIELD + " as wyz from  " + TABLENAME + " group by " + FIELD + " having count(" + FIELD + ")>1)");
                            }
                        }
                        else if (CHECKTYPE == "值域检查")
                        {
                            try
                            {
                                if (DOMAINTYPE == "own")
                                {
                                    DataTable dt              = db.GetDataBySql("SELECT CODE_PK,CODE_WHERE FROM GISDATA_MATEDATA WHERE REG_NAME = '" + TABLENAME + "' AND FIELD_NAME = '" + FIELD + "'");
                                    string    CODETABLENAME   = dt.Rows[0]["CODE_PK"].ToString();
                                    string    CODEWHERESTRING = dt.Rows[0]["CODE_WHERE"].ToString();
                                    if (CODETABLENAME != "" && CODEWHERESTRING != "")
                                    {
                                        DataTable codeArr = null;
                                        if (CODETABLENAME == "GISDATA_ZQSJZD")
                                        {
                                            CommonClass common  = new CommonClass();
                                            string      gldwstr = common.GetConfigValue("GLDW");
                                            codeArr = db.GetDataBySql("SELECT C_CODE FROM " + CODETABLENAME + " WHERE " + CODEWHERESTRING + " AND LEFT(C_CODE,6)='" + gldwstr + "'");
                                        }
                                        else
                                        {
                                            codeArr = db.GetDataBySql("SELECT C_CODE FROM " + CODETABLENAME + " WHERE " + CODEWHERESTRING);
                                        }
                                        string[]          idInts      = codeArr.AsEnumerable().Select(d => d.Field <string>("C_CODE")).ToArray();
                                        string            codesString = String.Join("','", idInts);
                                        CommonClass       conClass    = new CommonClass();
                                        IFeatureWorkspace ifw         = conClass.GetFeatureWorkspaceByName(TABLENAME);
                                        IQueryDef         pQueryDef   = ifw.CreateQueryDef();
                                        pQueryDef.Tables      = TABLENAME;
                                        pQueryDef.SubFields   = "count(*) as errorCount";
                                        pQueryDef.WhereClause = FIELD + " IS NOT NULL AND " + FIELD + " <> '' AND " + FIELD + " not in ('" + codesString + "')";
                                        ICursor pCur  = pQueryDef.Evaluate();
                                        IRow    pRow  = pCur.NextRow();
                                        int     iInx  = pCur.Fields.FindField("errorCount");
                                        string  count = pRow.get_Value(iInx).ToString();
                                        if (int.Parse(count) > 0)
                                        {
                                            List <string> listItem = new List <string>();
                                            listItem.Add(CHECKTYPE);
                                            listItem.Add(NAME);
                                            listItem.Add(count);
                                            listItem.Add(FIELD + " IS NOT NULL AND " + FIELD + " <> '' AND " + FIELD + " not in ('" + codesString + "')");
                                            this.listError.Add(listItem);
                                        }
                                        nodeData["ERROR"]   = count;
                                        nodeData["ISCHECK"] = "已检查";
                                        Marshal.ReleaseComObject(pCur);
                                    }
                                    else
                                    {
                                        nodeData["ERROR"]   = "";
                                        nodeData["ISCHECK"] = "未检查";
                                    }
                                }
                                else if (DOMAINTYPE == "custom")
                                {
                                    string            CUSTOMVALUE = nodeData["CUSTOMVALUE"].ToString();
                                    CommonClass       conClass    = new CommonClass();
                                    IFeatureWorkspace ifw         = conClass.GetFeatureWorkspaceByName(TABLENAME);
                                    IQueryDef         pQueryDef   = ifw.CreateQueryDef();
                                    pQueryDef.Tables      = TABLENAME;
                                    pQueryDef.SubFields   = "count(*) as errorCount";
                                    pQueryDef.WhereClause = FIELD + " not in (" + CUSTOMVALUE + ")";
                                    ICursor pCur  = pQueryDef.Evaluate();
                                    IRow    pRow  = pCur.NextRow();
                                    int     iInx  = pCur.Fields.FindField("errorCount");
                                    string  count = pRow.get_Value(iInx).ToString();
                                    if (int.Parse(count) > 0)
                                    {
                                        List <string> listItem = new List <string>();
                                        listItem.Add(CHECKTYPE);
                                        listItem.Add(NAME);
                                        listItem.Add(count);
                                        listItem.Add(FIELD + " not in (" + CUSTOMVALUE + ")");
                                        this.listError.Add(listItem);
                                    }
                                    nodeData["ERROR"]   = count;
                                    nodeData["ISCHECK"] = "已检查";
                                    Marshal.ReleaseComObject(pCur);
                                }
                            }catch (Exception e)
                            {
                                LogHelper.WriteLog(typeof(FormAttrDia), e);
                            }
                        }
                        else if (CHECKTYPE == "项目名称检查")
                        {
                            try{
                                string[]    arrStr       = FIELD.Split('#');
                                string      fieldStr     = arrStr[0];
                                string      taskfieldStr = "CONCAT(" + arrStr[1].Replace("&", ",") + ")";
                                CommonClass common       = new CommonClass();
                                string      gldwstr      = common.GetConfigValue("GLDW");
                                DataTable   xmmcArr      = db.GetDataBySql("SELECT " + taskfieldStr + " AS XMMCARR FROM GISDATA_TASK WHERE YZLGLDW ='" + gldwstr + "'");
                                string[]    idInts       = xmmcArr.AsEnumerable().Select(d => d.Field <string>("XMMCARR")).ToArray();
                                string      codesString  = String.Join("','", idInts);

                                CommonClass       conClass  = new CommonClass();
                                IFeatureWorkspace ifw       = conClass.GetFeatureWorkspaceByName(TABLENAME);
                                IQueryDef         pQueryDef = ifw.CreateQueryDef();
                                pQueryDef.Tables      = TABLENAME;
                                pQueryDef.SubFields   = "count(*) as errorCount";
                                pQueryDef.WhereClause = fieldStr + " not in ('" + codesString + "')";
                                ICursor pCur  = pQueryDef.Evaluate();
                                IRow    pRow  = pCur.NextRow();
                                int     iInx  = pCur.Fields.FindField("errorCount");
                                string  count = pRow.get_Value(iInx).ToString();
                                if (int.Parse(count) > 0)
                                {
                                    List <string> listItem = new List <string>();
                                    listItem.Add(CHECKTYPE);
                                    listItem.Add(NAME);
                                    listItem.Add(count);
                                    listItem.Add(fieldStr + " not in ('" + codesString + "')");
                                    this.listError.Add(listItem);
                                }
                                nodeData["ERROR"]   = count;
                                nodeData["ISCHECK"] = "已检查";
                                Marshal.ReleaseComObject(pCur);
                            }
                            catch (Exception e)
                            {
                                LogHelper.WriteLog(typeof(FormAttrDia), e);
                                LogHelper.WriteLog(typeof(FormAttrDia), "项目名称检查错误");
                            }
                        }
                        if (nodeData["ERROR"].ToString() != "0")
                        {
                            attrErrorTable.ImportRow(nodeData.Row);
                        }



                        XmlElement Xmlnode = doc.CreateElement("attr");
                        ////创建bai用户du名节点
                        //XmlElement element1 = doc.CreateElement("ID");
                        //element1.InnerText = nodeData["ID"].ToString();
                        //Xmlnode.AppendChild(element1);
                        ////创建密码节点
                        //XmlElement element2 = doc.CreateElement("ERROR");
                        //element2.InnerText = nodeData["ERROR"].ToString();
                        //Xmlnode.AppendChild(element2);
                        Attrs.AppendChild(Xmlnode);
                        XmlAttribute xa = doc.CreateAttribute("key");
                        xa.Value = nodeData["ID"].ToString();
                        XmlAttribute xa2 = doc.CreateAttribute("value");
                        xa2.Value = nodeData["ERROR"].ToString();
                        Xmlnode.SetAttributeNode(xa);
                        Xmlnode.SetAttributeNode(xa2);
                    }
                    if (node.Nodes.Count != 0)
                    {
                        loopCheck(node.Nodes, Attrs, doc);
                    }
                }
            }
        }
 public ActionResult DailyLog()
 {
     //Validate User Pemissions
     @ViewBag.CreatePermission = CommonClass.GetPermission(SecurityAgency.Common.Utility.EnumUtility.Permissions.AddDailyLog);
     return(View());
 }
Exemple #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            objCommonMIS.EmpId            = Membership.GetUser().UserName.ToString();
            objCommonMIS.BusinessLine_Sno = "2";
            objCommonMIS.RegionSno        = "0";
            objCommonMIS.BranchSno        = "0";

            if (!Page.IsPostBack)
            {
                if (objCommonMIS.CheckLoogedInASC() > 0)
                {
                    objCommonMIS.GetASCRegions(ddlRegion);
                    if (ddlRegion.Items.Count == 2)
                    {
                        ddlRegion.SelectedIndex = 1;
                    }
                    if (ddlRegion.Items.Count != 0)
                    {
                        objCommonMIS.RegionSno = ddlRegion.SelectedValue;
                    }
                    else
                    {
                        objCommonMIS.RegionSno = "0";
                    }

                    objCommonMIS.GetASCBranchs(ddlBranch);
                    if (ddlBranch.Items.Count == 2)
                    {
                        ddlBranch.SelectedIndex = 1;
                    }
                    objCommonMIS.BranchSno = ddlBranch.SelectedValue;

                    objCommonMIS.GetSCs(ddlASC);
                    if (ddlASC.Items.Count == 2)
                    {
                        ddlASC.SelectedIndex = 1;
                    }
                    objCommonMIS.GetASCProductDivisions(ddlProductDivison);
                }
                else
                {
                    objCommonMIS.GetUserRegionsMTS_MTO(ddlRegion);
                    if (ddlRegion.Items.Count == 2)
                    {
                        ddlRegion.SelectedIndex = 1;
                    }
                    if (ddlRegion.Items.Count != 0)
                    {
                        objCommonMIS.RegionSno = ddlRegion.SelectedValue;
                    }
                    else
                    {
                        objCommonMIS.RegionSno = "0";
                    }

                    objCommonMIS.GetUserBranchs(ddlBranch);
                    if (ddlBranch.Items.Count == 2)
                    {
                        ddlBranch.SelectedIndex = 1;
                    }
                    objCommonMIS.BranchSno = ddlBranch.SelectedValue;
                    objCommonMIS.GetUserSCs(ddlASC);
                    if (ddlASC.Items.Count == 2)
                    {
                        ddlASC.SelectedIndex = 1;
                    }
                    objPendingDefectiveSpare.ASC_Id = 0;
                    objPendingDefectiveSpare.BindProductDivisionData(ddlProductDivison);
                    objPendingDefectiveSpare.ProductDivision_Id = 0;
                }
                ViewState["Column"] = "ASC_Name";
                ViewState["Order"]  = "ASC";
            }
            System.Threading.Thread.Sleep(int.Parse(ConfigurationManager.AppSettings["AjaxPleaseWaitTime"]));
        }
        catch (Exception ex)
        {
            CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
        FillDropDownToolTip();
        FillRegionDropDownToolTip();
        FillBranchDropDownToolTip();
        FillDivisionDropDownToolTip();
    }
Exemple #17
0
        protected void Add_Save_Button_Command(object sender, CommandEventArgs e)
        {
            MySqlConnection dbconn = new MySqlConnection(CommonClass.connectionstring);

            dbconn.Open();
            string     lPhotoFileName = null;
            FileUpload lFileUpload1   = Product_Form_View.FindControl("FileUpload1") as FileUpload;

            if (lFileUpload1.HasFile)
            {
                Random lRandom = new Random();
                lPhotoFileName = lRandom.Next().ToString() + lFileUpload1.FileName;
                lFileUpload1.SaveAs(Server.MapPath("~/img/" + lPhotoFileName));
            }
            else if (Product_Form_View.CurrentMode == FormViewMode.Edit)
            {
                Image lImage1 = Product_Form_View.FindControl("Product_Image") as Image;

                if (lImage1.ImageUrl != "" && lImage1.ImageUrl != null)
                {
                    string[] lImageUrgl = lImage1.ImageUrl.Split(new char[] { '/' });
                    lPhotoFileName = lImageUrgl[lImageUrgl.Length - 1];
                }
            }

            string lProduct_Name = Server.HtmlEncode((Product_Form_View.FindControl("Product_Name") as TextBox).Text);
            string lProductId    = null;

            if (Product_Form_View.CurrentMode == FormViewMode.Insert)
            {
                string[] lValues = CommonClass.ExecuteQuery("ADD_PRODUCT",
                                                            new string[]
                {
                    "P_PRODUCT_NAME",
                    "P_PRODUCT_CATEGORY_ID",
                    "P_PHOTO_FILE_NAME",
                    "P_MEASUREMENT_ID",
                    "P_SUMMARY",
                    "P_HIGHLIGHT_TEXT"
                },
                                                            new string[]
                {
                    lProduct_Name,
                    (Product_Form_View.FindControl("PRODUCT_CATEGORY_ID") as DropDownList).SelectedValue.ToString(),
                    lPhotoFileName,
                    (Product_Form_View.FindControl("Measurement_Id") as DropDownList).SelectedValue.ToString(),
                    Server.HtmlEncode((Product_Form_View.FindControl("SUMMARY") as Obout.Ajax.UI.HTMLEditor.Editor).Content),
                    Server.HtmlEncode((Product_Form_View.FindControl("HIGHLIGHT_TEXT") as TextBox).Text)
                },
                                                            new string[]
                {
                    "P_PRODUCT_ID"
                },
                                                            dbconn);
                lProductId = lValues[0];
            }
            else
            {
                lProductId = Product_Form_View.DataKey.Values[0].ToString();
                CommonClass.ExecuteQuery("UPDATE_PRODUCT",
                                         new string[]
                {
                    "P_PRODUCT_ID",
                    "P_PRODUCT_CATEGORY_ID",
                    "P_PRODUCT_NAME",
                    "P_MEASUREMENT_ID",
                    "P_HIGHLIGHT_TEXT",
                    "P_SUMMARY",
                    "P_PHOTO_FILE_NAME"
                },
                                         new string[]
                {
                    lProductId,
                    (Product_Form_View.FindControl("Product_Category_Id") as DropDownList).SelectedValue.ToString(),
                    Server.HtmlEncode((Product_Form_View.FindControl("Product_Name") as TextBox).Text),
                    (Product_Form_View.FindControl("Measurement_Id") as DropDownList).SelectedValue.ToString(),
                    Server.HtmlEncode((Product_Form_View.FindControl("HIGHLIGHT_TEXT") as TextBox).Text),
                    Server.HtmlEncode((Product_Form_View.FindControl("SUMMARY") as AjaxControlToolkit.HTMLEditor.Editor).Content),
                    lPhotoFileName
                },
                                         dbconn);
            }


            Refresh_Product_View(dbconn);
            dbconn.Close();
            MultiView1.SetActiveView(Product_All_View);
        }
Exemple #18
0
    public DataTable viewSubmitMessage(string userName)
    {
        CommonClass cc = new CommonClass();

        return cc.reDt("select * from ApplyList where applier = '"+userName+"' order by applyDate desc");
    }
    protected void imgBtnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            if (hndEscalationId.Value != "")
            {
                //Assigning values to properties
                objWSCEscalationMatrix.EscalationId = int.Parse(hndEscalationId.Value.ToString());

                objWSCEscalationMatrix.RegionId          = Convert.ToInt32(ddlRegion.SelectedValue.ToString());
                objWSCEscalationMatrix.StateId           = Convert.ToInt32(ddlState.SelectedValue.ToString());
                objWSCEscalationMatrix.ProductdivisionId = Convert.ToInt32(ddlProductDiv.SelectedValue.ToString());

                objWSCEscalationMatrix.To_UserId  = Fn_Get_Value_ListBox(lstToUser);
                objWSCEscalationMatrix.CC_UserId  = Fn_Get_Value_ListBox(lstCCUser);
                objWSCEscalationMatrix.To_UserId1 = Fn_Get_Value_ListBox(lstToUser1);
                objWSCEscalationMatrix.CC_UserId1 = Fn_Get_Value_ListBox(lstCCUser1);
                if (txtElaspTimeMatrix1.Text.Trim() == "")
                {
                    objWSCEscalationMatrix.ElaspTimeMatrix1 = 0;
                }
                else
                {
                    objWSCEscalationMatrix.ElaspTimeMatrix1 = Convert.ToInt32(txtElaspTimeMatrix1.Text.Trim());
                }
                objWSCEscalationMatrix.To_UserId2 = Fn_Get_Value_ListBox(lstToUser2);
                //objWSCEscalationMatrix.CC_UserId2 = Fn_Get_Value_ListBox(lstCCUser2);
                if (txtElaspTimeMatrix2.Text.Trim() == "")
                {
                    objWSCEscalationMatrix.ElaspTimeMatrix2 = 0;
                }
                else
                {
                    objWSCEscalationMatrix.ElaspTimeMatrix2 = Convert.ToInt32(txtElaspTimeMatrix2.Text.Trim());
                }

                objWSCEscalationMatrix.EmpCode    = Membership.GetUser().UserName.ToString();
                objWSCEscalationMatrix.ActiveFlag = rdoStatus.SelectedValue.ToString();


                string strMsg = objWSCEscalationMatrix.SaveData("UPDATE_ESCALATION_MATRIX");
                if (objWSCEscalationMatrix.ReturnValue == -1)
                {
                    lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.ErrorInStoreProc, enuMessageType.Error, false, "");
                }
                else
                {
                    if (strMsg == "Exists")
                    {
                        lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.ActivateStatusNotChange, enuMessageType.UserMessage, false, "");
                    }
                    else
                    {
                        lblMessage.Text = CommonClass.getErrorWarrning(enuErrorWarrning.RecordUpdated, enuMessageType.UserMessage, false, "");
                    }
                }
            }
        }

        catch (Exception ex)
        {
            //Writing Error message to File using CommonClass WriteErrorErrFile method taking arguments as URL of page
            // trace, error message
            CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
        objCommonClass.BindDataGrid(gvComm, "uspWSCEscalationMatrix", true, sqlParamSrh, lblRowCount);
        ClearControls();
    }
Exemple #20
0
 public DIClass(CommonClass cc, TestClass tc)
 {
     tc.Value = 42;
     TC       = tc;
 }
Exemple #21
0
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     //null the both class object.
     objCommonClass   = null;
     objRoutingMaster = null;
 }
Exemple #22
0
        private bool CreateShapeFile(BaseControlGroup b)
        {
            string msg = string.Empty;

            System.Data.DataSet ds;
            string currentStat = string.Empty;

            try
            {
                currentStat = _currentStat;

                ModelDataLine modelDataLine = new ModelDataLine(); if (tabControl1.SelectedIndex == 0)
                {
                    WaitShow("Loading model data file.");

                    modelDataLine.DatabaseFilePath = txtModelDatabase.Text;
                    System.Data.DataTable dtModel = CommonClass.ExcelToDataTable(txtModelDatabase.Text);
                    DataSourceCommonClass.UpdateModelDataLineFromDataSet(b.Pollutant, modelDataLine, dtModel);
                }
                else
                {
                    StreamReader sr = new StreamReader(txtModelFile.Text);
                    string       csvDataLine;

                    csvDataLine = "";

                    string fileDataLine;

                    fileDataLine = sr.ReadLine();

                    string[] sMatchArray = fileDataLine.Split(new char[] { ',' });
                    if (!(sMatchArray[0].Replace("\"", "") == b.Pollutant.PollutantName && sMatchArray[1] == b.GridType.GridDefinitionName && sMatchArray[2].Replace("\"", "") == "Model"))
                    {
                        MessageBox.Show("The pollutant or grid definition do not match.");
                        return(false);
                    }
                    WaitShow("Loading model data file...");
                    string strLine = "";
                    ds = new System.Data.DataSet();
                    DataTable dt = new DataTable();
                    DataRow   dr = null;
                    string[]  strArray;
                    strLine = sr.ReadLine();
                    if (strLine != null && strLine.Length > 0)
                    {
                        strArray = strLine.Split(',');
                        for (int i = 0; i < strArray.Count(); i++)
                        {
                            dt.Columns.Add(strArray[i]);
                        }
                    }
                    while (strLine != null)
                    {
                        strLine = sr.ReadLine();
                        if (strLine != null && strLine.Length > 0)
                        {
                            dr       = dt.NewRow();
                            strArray = strLine.Split(',');
                            for (int i = 0; i < strArray.Count(); i++)
                            {
                                dr[i] = strArray[i];
                            }
                            dt.Rows.Add(dr);
                        }
                    }
                    ds.Tables.Add(dt);
                    modelDataLine.DatabaseFilePath = txtModelFile.Text;
                    DataSourceCommonClass.UpdateModelDataLineFromDataSetNewFormat(b.Pollutant, ref modelDataLine, ds);
                    sr.Close();
                    switch (currentStat)
                    {
                    case "baseline":
                        b.Base          = null;
                        b.Base          = modelDataLine;
                        b.Base.GridType = b.GridType;
                        break;

                    case "control":
                        b.Control          = null;
                        b.Control          = modelDataLine;
                        b.Control.GridType = b.GridType;
                        break;
                    }
                }
                System.Threading.Thread.Sleep(100); WaitClose();
                switch (currentStat)
                {
                case "baseline":
                    b.Base = null;
                    b.Base = modelDataLine;
                    break;

                case "control":
                    b.Control = null;
                    b.Control = modelDataLine;
                    break;
                }
                if (modelDataLine.ModelAttributes.Count == 0 && modelDataLine.ModelResultAttributes.Count == 0)
                {
                    msg = "Error reading files.";
                    return(false);
                }
                int           threadId = -1;
                AsyncDelegate asyncD   = new AsyncDelegate(AsyncCreateFile);
                IAsyncResult  ar       = asyncD.BeginInvoke(b, modelDataLine, currentStat, out threadId, null, null);
                return(true);
            }
            catch (Exception ex)
            {
                WaitClose();
                Logger.LogError(ex);
                return(false);
            }
            finally
            {
                if (msg != string.Empty)
                {
                    MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #23
0
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     objCommonClass        = null;
     objBusinessAreaMaster = null;
 }
Exemple #24
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        objCallRegistration.Type = "REGISTER_MTS_COMPLAINT";

        objCallRegistration.CustomerID      = int.Parse(hdnCustomerId.Value);
        objCallRegistration.Prefix          = ddlPrefix.SelectedValue.ToString();
        objCallRegistration.FirstName       = txtFirstName.Text.Trim();
        objCallRegistration.MiddleName      = txtMiddleName.Text.Trim();
        objCallRegistration.LastName        = txtLastName.Text.Trim();
        objCallRegistration.CompanyName     = txtCompanyName.Text.Trim();
        objCallRegistration.OEMCustomerName = TxtOEMCustName.Text.Trim();

        objCallRegistration.Address1           = txtAdd1.Text.ToString();
        objCallRegistration.Address2           = txtAdd2.Text.ToString();
        objCallRegistration.Landmark           = txtLandmark.Text.Trim();
        objCallRegistration.CountrySNo         = Convert.ToInt32(DdlCountry.SelectedValue);
        objCallRegistration.CountryName        = DdlCountry.SelectedItem.Text;
        objCallRegistration.City               = txtCity.Text.Trim();
        objCallRegistration.Email              = txtEmail.Text.Trim();
        objCallRegistration.ContactNo          = txtContactNo.Text.Trim();
        objCallRegistration.AlternateContactNo = txtAltConatctNo.Text.Trim();
        objCallRegistration.Extension          = txtExtension.Text.Trim();

        objCallRegistration.ProductDivSNo   = Convert.ToInt32(ddlProductDiv.SelectedValue);
        objCallRegistration.ProductLineSno  = Convert.ToInt32(ddlProductLine.SelectedValue);
        objCallRegistration.ProductGroupSNo = Convert.ToInt32(ddlProductGroup.SelectedValue);
        objCallRegistration.ProductSNo      = Convert.ToInt32(ddlProduct.SelectedValue);
        if (!String.IsNullOrEmpty(txtPurchaseDate.Text.Trim()))
        {
            objCallRegistration.PurchaseDate = txtPurchaseDate.Text.Trim();
        }
        objCallRegistration.PurchaseFrom = txtDealerName.Text.Trim();
        objCallRegistration.InvoiceNo    = txtInvoiceNum.Text.Trim();

        objCallRegistration.Remarks  = txtComplaintDetails.Text.Trim();
        objCallRegistration.LoggedBy = TxtLoggedBy.Text.Trim(); // Bhawesh 16-4-13
        objCallRegistration.RegisterMTSComplaint();

        ArrayList arrListFiles = new ArrayList();

        //Inserting DraftComplaintDetails
        if (objCallRegistration.CustomerID > 0)
        {
            #region Upload file
            //uploading Files to Server on Folder Docs/Customer

            strFileSavePath = ConfigurationSettings.AppSettings["CustomerFilePath"].ToString();
            dTableFile      = (DataTable)ViewState["dTableFile"];
            if (flUpload.Value != "")
            {
                try
                {
                    if (!Directory.Exists(strFileSavePath))
                    {
                        Directory.CreateDirectory(Server.MapPath(strFileSavePath));
                    }
                    strvFileName = flUpload.Value;
                    strFileName  = Path.GetFileName(strvFileName);
                    strExt       = Path.GetExtension(strvFileName);
                    strFileName  = Path.GetFileNameWithoutExtension(strvFileName) + "_" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
                    strFileName  = strFileName + strExt;
                    DataRow dRow = dTableFile.NewRow();
                    dRow["FileName"] = strFileName;
                    dTableFile.Rows.Add(dRow);
                    ViewState["dTableFile"] = dTableFile;
                    flUpload.PostedFile.SaveAs(Server.MapPath(strFileSavePath + strFileName));
                }
                catch (Exception ex)
                {
                    CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
                }
            }
            dTableFile = (DataTable)ViewState["dTableFile"];
            for (intCnt = 0; intCnt < dTableFile.Rows.Count; intCnt++)
            {
                arrListFiles.Add(dTableFile.Rows[intCnt]["FileName"].ToString());
            }
            //Uploading Files End
            #endregion Upload file
            //Create Temp table for Complaint + SC Name
            DataTable  dTableTemp      = new DataTable();
            DataColumn dColNo          = new DataColumn("SNo");
            DataColumn dColComplaintNo = new DataColumn("ComplaintRefNo");
            DataColumn dColProd        = new DataColumn("ProductDivision");
            dTableTemp.Columns.Add(dColNo);
            dTableTemp.Columns.Add(dColComplaintNo);
            dTableTemp.Columns.Add(dColProd);

            if (objCallRegistration.ReturnValue == 1)
            {
                #region Save FileData
                RequestRegistration objCallreg = new RequestRegistration();
                //Saving FileNames to DB
                for (int i = 0; i < arrListFiles.Count; i++)
                {
                    objCallreg.EmpCode = Membership.GetUser().UserName.ToString();
                    objCallreg.Type    = "INSERT_COMPLAINT_FILES_DATA";
                    objCallreg.SaveFilesWithComplaintno(objCallRegistration.Complaint_RefNoOUT, arrListFiles[i].ToString());
                }
                objCallreg = null;
                //End Saving
                #endregion Save FileData
                #region For Display Final Grid
                //Creating row for temp table
                DataRow dRowTEMP = dTableTemp.NewRow();

                dRowTEMP["SNo"]             = dTableTemp.Rows.Count + 1;
                dRowTEMP["ProductDivision"] = ddlProductDiv.SelectedItem.Text;
                dRowTEMP["ComplaintRefNo"]  = objCallRegistration.Complaint_RefNoOUT;
                dTableTemp.Rows.Add(dRowTEMP);

                btnNext.Visible         = true;
                btnNext.CommandArgument = objCallRegistration.Complaint_RefNoOUT;
                #endregion For Display Final Grid
            }

            //Assigning DataSource to Grid
            gvFinal.DataSource = dTableTemp;
            gvFinal.DataBind();
            //End
            //Clear Files For File Upload Grid
            dTableFile = (DataTable)ViewState["dTableFile"];
            dTableFile.Rows.Clear();
            ViewState["dTableFile"] = dTableFile;

            gvFiles.Visible = false;

            //End
            //Clear Product Grid
            btnSubmit.CausesValidation = true;
            tableResult.Visible        = true;
            btnSubmit.Enabled          = false;
            btnCancel.Enabled          = false;
            ClearControls();
            lblMsg.Text = "";
        }
    }
Exemple #25
0
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                string strXHTM = this.textBox1.Text.Trim();
                string strCPBH = (string)DataClass.GetValue("select cpbh from pdlots with(nolock) where prodno=(select 生产制令号 from 成品条码表_3M where 箱号条码='" + strXHTM + "')");
                if (strCPBH == null)
                {
                    MessageBox.Show("此条码并不存在!");
                    this.Clear();
                    return;
                }
                this.cpbh = strCPBH;

                string file1 = "", file2 = "", file3 = "";
                //导通检查
                switch (this.CheckFiles(this.paths_dt, strXHTM, ref file1))
                {
                case 1:
                    this.checkBox1.Checked = true;
                    break;

                case 0:
                    MessageBox.Show("导通测试未通过!");
                    this.Clear();
                    return;

                case -1:
                    MessageBox.Show("网络异常,无法访问导通测试目录,请联系电脑工程师!");
                    this.Clear();
                    return;
                }

                //烧录检查
                switch (this.CheckFiles(this.paths_sl, strXHTM, ref file2))
                {
                case 1:
                    this.checkBox2.Checked = true;
                    break;

                case 0:
                    MessageBox.Show("烧录测试未通过!");
                    this.Clear();
                    return;

                case -1:
                    MessageBox.Show("网络异常,无法访问烧录测试目录,请联系电脑工程师!");
                    this.Clear();
                    return;
                }

                //高频检查
                switch (this.CheckFiles(this.paths_gp, strXHTM, ref file3))
                {
                case 1:
                    this.checkBox3.Checked = true;
                    break;

                case 0:
                    MessageBox.Show("高频测试未通过!");
                    this.Clear();
                    return;

                case -1:
                    MessageBox.Show("网络异常,无法访问高频测试目录,请联系电脑工程师!");
                    this.Clear();

                    return;
                }


                //更新数据库
                string sql = "update 成品条码表_3M set 测试通过=1,测试时间=getdate(),导通测试文件='" + file1 + "',烧录测试文件='" + file2 + "',高频测试文件='" + file3 + "' where 箱号条码='" + strXHTM + "'";
                if (DataClass.Execute(sql))
                {
                    CommonClass.PlaySoundOK();
                    MessageBox.Show("测试通过!");
                }
                else
                {
                    CommonClass.PlaySoundNG();
                    MessageBox.Show("保存到数据库失败,请重新尝试或联系系统管理员!");
                }
                this.Clear();
            }
        }
Exemple #26
0
 protected void Page_UnLoad(object sender, EventArgs e)
 {
     objCommonClass      = null;
     objCallRegistration = null;
     objSCPopupMaster    = null;
 }
Exemple #27
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            //Assigning values to properties
            objwscCustomerComplaint.WSCCustomerId          = hdnWSCCustomerId.Value;
            objwscCustomerComplaint.Prefix                 = ddlPrefix.SelectedValue.ToString();
            objwscCustomerComplaint.FileName               = txtFirstName.Text.Trim();
            objwscCustomerComplaint.LastName               = txtLastName.Text.Trim();
            objwscCustomerComplaint.Address                = txtAdd1.Text.Trim();
            objwscCustomerComplaint.Company_Name           = txtCompanyName.Text.Trim();
            objwscCustomerComplaint.Contact_No             = txtContactNo.Text.Trim();
            objwscCustomerComplaint.Country_Sno            = Convert.ToInt32(ddlCountry.SelectedValue);
            objwscCustomerComplaint.State_Sno              = Convert.ToInt32(ddlState.SelectedValue);
            objwscCustomerComplaint.City_Sno               = Convert.ToInt32(ddlCity.SelectedValue);
            objwscCustomerComplaint.Email                  = txtEmail.Text.Trim();
            objwscCustomerComplaint.Feedback_Type          = Convert.ToInt32(ddlFeedbackType.SelectedValue);
            objwscCustomerComplaint.Feedback               = txtfeedback.Text.Trim();
            objwscCustomerComplaint.ProductDivisionId      = Convert.ToInt32(ddlProductDiv.SelectedValue);
            objwscCustomerComplaint.ProductLineId          = Convert.ToInt32(ddlProductLine.SelectedValue);
            objwscCustomerComplaint.Rating_Voltage         = txtRating.Text.Trim();
            objwscCustomerComplaint.Manufacturer_Serial_No = txtManufacturerSerialNo.Text.Trim();

            objwscCustomerComplaint.Manufacture_Year    = txtxPurchaseDate.Text.Trim();
            objwscCustomerComplaint.Site_Location       = txtlocation.Text.Trim();
            objwscCustomerComplaint.Nature_of_Complaint = txtCompNature.Text.Trim();
            objwscCustomerComplaint.CGExe_Feedback      = Convert.ToInt32(ddlGCExecutive.SelectedValue.ToString());
            objwscCustomerComplaint.CGExe_Comment       = txtCGExecutive.Text.Trim();
            objwscCustomerComplaint.EmpCode             = Membership.GetUser().UserName.ToString();


            //uploading Files to Server on Folder Docs/Customer
            ArrayList arrListFiles = new ArrayList();
            strFileSavePath = ConfigurationSettings.AppSettings["CustomerFilePath"].ToString();
            dTableFile      = (DataTable)ViewState["dTableFile"];
            if (flUpload.Value != "")
            {
                try
                {
                    if (!Directory.Exists(strFileSavePath))
                    {
                        Directory.CreateDirectory(Server.MapPath(strFileSavePath));
                    }
                    strvFileName = flUpload.Value;
                    strFileName  = Path.GetFileName(strvFileName);
                    strExt       = Path.GetExtension(strvFileName);
                    strFileName  = Path.GetFileNameWithoutExtension(strvFileName) + "_" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
                    strFileName  = strFileName + strExt;
                    DataRow dRow = dTableFile.NewRow();
                    dRow["FileName"] = strFileName;
                    dTableFile.Rows.Add(dRow);
                    ViewState["dTableFile"] = dTableFile;
                    flUpload.PostedFile.SaveAs(Server.MapPath(strFileSavePath + strFileName));
                }
                catch (Exception ex)
                {
                    CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
                }
            }

            dTableFile = (DataTable)ViewState["dTableFile"];
            for (intCnt = 0; intCnt < dTableFile.Rows.Count; intCnt++)
            {
                arrListFiles.Add(dTableFile.Rows[intCnt]["FileName"].ToString());
            }
            //Uploading Files End

            objwscCustomerComplaint.SaveComplaint("UPDATE_CUSTOMER_INFORMATION");

            if (objwscCustomerComplaint.ReturnValue == -1)
            {
                lblMsg.Text = CommonClass.getErrorWarrning(enuErrorWarrning.ErrorInStoreProc, enuMessageType.Error, false, "");
            }
            else
            {
                // Save FileData
                RequestRegistration objCallreg = new RequestRegistration();
                for (int i = 0; i < arrListFiles.Count; i++)
                {
                    objwscCustomerComplaint.SaveFiles(objwscCustomerComplaint.WebRequest_RefNo, arrListFiles[i].ToString());
                }

                //End Saving
                lblMsg.Text = CommonClass.getErrorWarrning(enuErrorWarrning.AddRecord, enuMessageType.UserMessage, false, "");
                //Clear Files For File Upload Grid
                dTableFile = (DataTable)ViewState["dTableFile"];
                dTableFile.Rows.Clear();
                ViewState["dTableFile"] = dTableFile;
                BindGridFiles();
                gvFiles.Visible = false;
                //End

                if (ddlFeedbackType.SelectedValue == "1")
                {
                    //if (hdnProductSrno.Value != "0" || hdnProductSrno.Value != "")
                    //{
                    //Assign Value in Session
                    Session["PRODUCTSRNO"] = hdnProductSrno.Value;
                    Response.Redirect("../pages/MTOServiceRegistration.aspx");
                    //End
                    //Response.Redirect
                    //HttpContext.Current.Items.Add("PRODUCTSRNO", hdnProductSrno.Value);
                    //Server.Transfer("../pages/MTOServiceRegistration.aspx",false);
                    //}
                }
                else
                {
                    sqlParamSrh[1].Value = ddlSearch.SelectedValue.ToString();
                    sqlParamSrh[2].Value = txtSearch.Text.Trim();
                    objCommonClass.BindDataGrid(gvComm, "uspWSCCustomerRegistration", true, sqlParamSrh, lblRowCount);
                    ClearControls();
                }
            }
        }
        catch (Exception ex)
        {
            //Writing Error message to File using CommonClass WriteErrorErrFile method taking arguments as URL of page
            // trace, error message
            CommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
    }
Exemple #28
0
        protected void Calculate_Grand_Total()
        {
            GLOBAL_DISCOUNT_APPLIED.Value = "0";
            MySqlConnection dbconn = new MySqlConnection(CommonClass.connectionstring);

            dbconn.Open();
            Dictionary <string, string> parameters = Get_Global_Discounts(dbconn);
            double lGrandTotal      = 0.0;
            double lShippingCharges = 0.0;
            double lTotalQuantity   = 0.0;
            double lDiscounts       = 0.0;

            foreach (ListViewItem item in Product_ListView.Items)
            {
                ListView lv = (ListView)item.FindControl("Product_Order_ListView");
                foreach (ListViewItem item1 in lv.Items)
                {
                    DropDownList ddl       = (DropDownList)item1.FindControl("Quantity_Dropdown");
                    double       lQuantity = int.Parse(ddl.SelectedValue);
                    double       lSize     = double.Parse(lv.DataKeys[item1.DataItemIndex].Values[1].ToString());
                    if (lv.DataKeys[item1.DataItemIndex].Values[4].ToString() == "Litre")
                    {
                        lTotalQuantity += (lQuantity * lSize);
                    }

                    lGrandTotal += double.Parse((item1.FindControl("Subtotal") as Label).Text);
                    double lShippingCharge = double.Parse(lv.DataKeys[item1.DataItemIndex].Values[3].ToString());
                    if (Delivery_Method.SelectedValue == "" || Delivery_Method.SelectedValue == "3")
                    {
                        lShippingCharges += (lQuantity * lShippingCharge);
                    }
                    string lstr = lv.DataKeys[item1.DataItemIndex].Values[0].ToString() + "-" + lv.DataKeys[item1.DataItemIndex].Values[1].ToString();
                    //Response.Write(lstr + "<br>");
                    if (parameters.ContainsKey(lstr))
                    {
                        //  Response.Write(lQuantity + "<br>");
                        // Response.Write(parameters[lstr] + "<br>");
                        lDiscounts += (lQuantity * double.Parse(parameters[lstr]));
                        GLOBAL_DISCOUNT_APPLIED.Value = "1";
                    }
                }
            }
            Shipping_Charges.Text = lShippingCharges.ToString();
            Subtotal_Str.Text     = lGrandTotal.ToString();

            string[] lRecords = CommonClass.FetchRecords("GET_ACTIVE_PROMOTIONS",
                                                         new string[]
            {
                "PROMOTION_TYPE"
            },
                                                         new string[]
            {
                "GLOBAL"
            },
                                                         new string[]
            {
                "P_PROMOTION_ID",
                "P_TOTAL_QUANTITY",
                "P_TOTAL_ORDER"
            },
                                                         dbconn
                                                         );
            dbconn.Close();
            string lPromotionId        = lRecords[0];
            int    lDiscountedQuantity = int.Parse(lRecords[1]);

            GLOBAL_PROMOTION_ID.Value = "";

            if (USER_TYPE_ID.Value == "0")
            {
                lDiscounts             = lShippingCharges;
                Shipping_Discount.Text = lShippingCharges.ToString();
                double lDiscountValue = 0;
                if (DISCOUNT.Value != null && DISCOUNT.Value != "")
                {
                    lDiscountValue = double.Parse(DISCOUNT.Value);
                }
                if (lDiscountValue > 0)
                {
                    if (DISCOUNT_MEASUREMENT_ID.Value == "1")
                    {
                        lDiscounts += lTotalQuantity * lDiscountValue;
                    }
                    else if (DISCOUNT_MEASUREMENT_ID.Value == "2")
                    {
                        lDiscounts += (lGrandTotal * lDiscountValue) / 100;
                    }
                }
            }
            else
            {
                if (lTotalQuantity >= lDiscountedQuantity || SHIPPING_CHARGE_DISCOUNT_FLAG.Value == "Y")
                {
                    GLOBAL_PROMOTION_ID.Value = lPromotionId;
                    lDiscounts            += lShippingCharges;
                    Shipping_Discount.Text = lShippingCharges.ToString();
                }
            }

            //Promotion Discount
            if (Promotion_Id.Value != "")
            {
                if (lGrandTotal > 0.0)
                {
                    if (Promotion_Amount.Value != "")
                    {
                        lDiscounts += double.Parse(Promotion_Amount.Value);
                    }
                    else if (Promotion_Percentage.Value != "")
                    {
                        double lPromotionDiscount = (lGrandTotal * double.Parse(Promotion_Percentage.Value)) / 100;
                        double lPromotionMaximum  = double.Parse(Promotion_Maximum.Value);
                        if (lPromotionMaximum > 0)
                        {
                            lDiscounts += Math.Min(lPromotionDiscount, lPromotionMaximum);
                        }
                        else
                        {
                            lDiscounts += lPromotionDiscount;
                        }
                    }
                }
            }

            Discounts.Text = lDiscounts.ToString();

            Grand_Total.Text = (lGrandTotal + lShippingCharges - lDiscounts).ToString();
        }
        protected void Create_CC_Payment(Dictionary <string, string> pParameters)
        {
            MySqlConnection dbconn = new MySqlConnection(CommonClass.connectionstring);

            dbconn.Open();

            string lTxnDate   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string lTxnAmount = "";
            string lTxnId     = "";
            string lOrderId   = pParameters["order_id"];

            if (pParameters.ContainsKey("trans_date"))
            {
                lTxnDate = pParameters["trans_date"];
            }
            if (pParameters.ContainsKey("amount"))
            {
                lTxnAmount = pParameters["amount"];
            }
            if (pParameters.ContainsKey("tracking_id"))
            {
                lTxnId = pParameters["tracking_id"];
            }
            string[] lRecords = CommonClass.FetchRecords("ADD_CC_AVANUE_PAYMENT",
                                                         new string[]
            {
                "P_ORDER_ID",
                "P_PAYMENT_DATE",
                "P_PAYMENT_AMOUNT",
                "P_TRACKING_ID",
                "P_PAYMENT_MODE",
                "P_TRANSACTION_STATUS",
                "P_FAILURE_MESSAGE",
                "P_EXTERNAL_USER_ID",
                "P_USER_ID"
            },
                                                         new string[]
            {
                lOrderId,
                lTxnDate,
                lTxnAmount,
                lTxnId,
                pParameters["payment_mode"],
                pParameters["order_status"],
                pParameters["failure_message"],
                ClaimsPrincipal.Current.FindFirst("user_id").Value,
                null
            },
                                                         new string[]
            {
                "P_ERROR_STRING"
            },
                                                         dbconn);

            if ((!(lRecords[0] != null && lRecords[0] != "")) && pParameters["order_status"] == "Success")
            {
                OrderClass.Confirm_Order(dbconn, pParameters["order_id"]);
            }


            dbconn.Close();
            Session.Abandon();
            Session.Clear();
            Response.Redirect("~/OrderSummary.aspx?Order_Id=" + lOrderId);
        }
Exemple #30
0
        protected void Order_Form_OnCommand(object sender, CommandEventArgs e)
        {
            Message.Text = "";
            if (e.CommandName == "Place Order")
            {
                if (Page.IsValid && Validate_Order())
                {
                    MySqlConnection dbconn = new MySqlConnection(CommonClass.connectionstring);
                    dbconn.Open();
                    string lDeliveryMethod = "3"; // To be couriered
                    if (Delivery_Method.SelectedValue != "")
                    {
                        lDeliveryMethod = Delivery_Method.SelectedValue;
                    }
                    string[] lRecords = CommonClass.ExecuteQuery("ADD_ORDER1",
                                                                 new string[]
                    {
                        "P_USER_ID",
                        "P_EXTERNAL_USER_ID",
                        "P_ORDER_TOTAL",
                        "P_SHIPPING_CHARGE",
                        "P_DISCOUNTS",
                        "P_ADDRESS_ID",
                        "P_PROMOTION_ID",
                        "P_PAYMENT_TYPE",
                        "P_STATUS",
                        "P_DELIVERY_METHOD"
                    },
                                                                 new string[]
                    {
                        USER_ID.Value,
                        ClaimsPrincipal.Current.FindFirst("user_id").Value,
                        Grand_Total.Text,
                        Shipping_Charges.Text,
                        Discounts.Text,
                        AddressBook1.GetDeliveryAddressId,
                        Promotion_Id.Value,
                        PAYMENT_TYPE_ID.Value,
                        ORDER_STATUS.Value,
                        lDeliveryMethod
                    },
                                                                 new string[]
                    {
                        "P_ORDER_ID"
                    },
                                                                 dbconn);
                    foreach (ListViewItem item in Product_ListView.Items)
                    {
                        ListView lv = (ListView)item.FindControl("Product_Order_ListView");
                        foreach (ListViewItem item1 in lv.Items)
                        {
                            Label lSubtotalLabel = item1.FindControl("Subtotal") as Label;
                            if (lSubtotalLabel.Text != "0" && lSubtotalLabel.Text != "0.0")
                            {
                                CommonClass.ExecuteQuery("ADD_ORDER_DETAILS",
                                                         new string[]
                                {
                                    "P_ORDER_ID",
                                    "P_PRODUCT_ID",
                                    "P_MEASUREMENT_UNIT",
                                    "P_QUANTITY",
                                    "P_PRICE"
                                },
                                                         new string[]
                                {
                                    lRecords[0],
                                    lv.DataKeys[item1.DataItemIndex].Values[0].ToString(),
                                    lv.DataKeys[item1.DataItemIndex].Values[1].ToString(),
                                    (item1.FindControl("Quantity_DropDown") as DropDownList).SelectedValue.ToString(),
                                    lv.DataKeys[item1.DataItemIndex].Values[2].ToString()
                                },
                                                         dbconn
                                                         );
                            }
                        }
                    }
                    ORDER_ID.Value = lRecords[0];
                    if (PAYMENT_TYPE_ID.Value == "Cash")
                    {
                        PaymentClass.Create_Cash_Payment(dbconn,
                                                         Grand_Total.Text,
                                                         USER_ID.Value);
                    }


                    //string lPaymentType = "";
                    //if (PAYMENT_TYPE_ID.Value != "" && PAYMENT_TYPE_ID.Value != null)
                    //{
                    //    MySqlCommand dbcomm = new MySqlCommand("SELECT GET_ATTRIBUTE_VALUE(GET_PAYMENT_TYPE_MASTER_TYPE(), " + PAYMENT_TYPE_ID.Value + ")", dbconn);
                    //   MySqlDataReader reader = dbcomm.ExecuteReader();

                    //                        while (reader.Read())
                    //                      {
                    //                        lPaymentType = reader[0].ToString();
                    //                  }
                    //                reader.Close();
                    //          }

                    if (PAYMENT_TYPE_ID.Value == WalletPaymentType)
                    {
                        UserModel lUserModel = CommonClass.Get_External_User_Profile(dbconn);

                        PaymentClass.Initiate_PayTm_Order(ORDER_ID.Value,
                                                          Grand_Total.Text,
                                                          lUserModel.Email_Address,
                                                          lUserModel.Mobile_Number);
                        dbconn.Close();
                    }
                    else if (PAYMENT_TYPE_ID.Value == OthersPaymentType)
                    {
                        UserModel lUserModel = CommonClass.Get_External_User_Profile(dbconn);

                        PaymentClass.Initiate_CCAvenue_Order(ORDER_ID.Value,
                                                             Grand_Total.Text,
                                                             lUserModel.Email_Address,
                                                             lUserModel.Mobile_Number,
                                                             AddressBook1.GetDeliveryAddressId,
                                                             dbconn);
                        dbconn.Close();
                    }
                    else
                    {
                        OrderClass.Confirm_Order(dbconn, ORDER_ID.Value);
                        dbconn.Close();

                        if (SuccessOrder != null)
                        {
                            SuccessOrder(this, EventArgs.Empty);
                        }
                    }
                }
            }
        }
 private void EnterEvent(object sender, EventArgs e)
 {
     CommonClass.EnterEvents(sender, e);
 }
    private void BindSearchSection()
    {
        try
        {
            // For Upload Excel File
            CommonClass obj = new CommonClass();

            if (Roles.FindUsersInRole(_userRole, objDdl.EmpId).Any())
            {
                objDdl.BindAllRegion(ddlRegion);
                //objDdl.BindProductDivision(ddlPdivision); Not visibile in case of Admin for upload records.
                if (ddlRegion.Items.FindByValue("8") != null)
                {
                    ListItem lstRegionSearch = ddlRegion.Items.FindByValue("8");
                    ddlRegion.Items.Remove(lstRegionSearch);
                }
            }
            else
            {
                objcmb.Role = obj.GetRolesForUser(objDdl.EmpId);

                if (objcmb.Role.Contains("SC") == true)
                {
                    objcmb.Role = "SC";
                    ddlRegion.Items.Clear();
                    ddlBranchSearch.Items.Clear();
                    ddlRegion.Enabled       = false;
                    ddlBranchSearch.Enabled = false;
                    objDdl.EmpId            = Membership.GetUser().UserName;
                    objDdl.RegionSno        = 0;
                    objDdl.BranchSno        = 0;
                    GetUserSCs(ddlServicecontractorSearch, objDdl.EmpId);
                    // objDdl.BindProductDivision(ddlproddivision);
                    ListItem removeItems = ddlServicecontractorSearch.Items.FindByValue("0");
                    ddlServicecontractorSearch.Items.Remove(removeItems);
                }
                else
                {
                    if (objcmb.Role.Contains("AISH") == true)
                    {
                        objcmb.Role = "AISH";
                    }

                    if (objcmb.Role.Contains("RSH") == true)
                    {
                        objcmb.Role = "RSH";
                    }
                    else if (objcmb.Role.Contains("EIC") == true)
                    {
                        objcmb.Role = "EIC";
                    }

                    objcmb.EmpId = Membership.GetUser().UserName;
                    objcmb.GetUserRegionsByRoleMts(ddlRegion);

                    if (ddlRegion.Items.FindByValue("8") != null)
                    {
                        ListItem lstRegion = ddlRegion.Items.FindByValue("8");
                        ddlRegion.Items.Remove(lstRegion);
                    }


                    objcmb.RegionSno = int.Parse(ddlRegion.SelectedValue);
                    objcmb.GetUserBranchsByRole(ddlBranchSearch);

                    ddlBranchSearch.Items.Insert(0, new ListItem("Select", "1111"));

                    objcmb.BranchSno = int.Parse(ddlBranchSearch.SelectedValue);
                    if (ddlRegion.Items.Count > 1)
                    {
                        ddlRegion.SelectedValue = "0";
                    }
                }

                objDdl.BindProductDivision(ddlproddivision);
                ListItem removeItem = ddlproddivision.Items.FindByValue("0");
                ddlproddivision.Items.Remove(removeItem);
                ddlproddivision.Items.Insert(0, new ListItem("All", "0"));
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemple #33
0
    /// <summary>
    /// 根据连接字符串返回单周课表
    /// </summary>
    /// <param name="weekNum">第几周</param>
    /// <param name="sqlstr">连接字符串(需包含第几周intDay第几节intStartNum,intEndNum等信息)</param>
    /// <param name="printstr">单元格要显示的内容</param>
    public static DataTable PrintTab_Week_DT(int weekNum, string sqlstr, string printstr)
    {
        sqlstr = sqlstr + " and intweek = " + weekNum;
        SqlConnection  con = CommonClass.GetSqlConnection();
        SqlDataAdapter sda = new SqlDataAdapter();

        sda.SelectCommand = new SqlCommand(sqlstr, con);
        DataSet ds = new DataSet();

        sda.Fill(ds);
        DataTable table = new DataTable();

        table = ds.Tables[0];
        DataTable dtSchedule = new DataTable();


        //添加八列
        dtSchedule.Columns.Add("查询");
        for (int i = 1; i < 8; i++)
        {
            dtSchedule.Columns.Add(Convert.ToString(i));
        }

        //添加10行
        for (int i = 0; i < 11; i++)
        {
            dtSchedule.Rows.Add();
        }

        //添加左侧固定信息(第几节)
        for (int i = 0; i < 11; i++)
        {
            dtSchedule.Rows[i][0] = (i + 1);
        }

        //此数组用于存放需要合并的单元格信息。如:需要合并第一列的一、二单元格
        //那么,数组中一行的三个数分别为1,1,2
        int[][] tempArray = new int[table.Rows.Count][];
        for (int i = 0; i < table.Rows.Count; i++)
        {
            tempArray[i] = new int[3];
            for (int j = 0; j < 3; j++)
            {
                tempArray[i][j] = 0;
            }
        }

        //遍历table,将每条课表信息填在tab中适当的位置。
        for (int i = 0; i < table.Rows.Count; i++)
        {
            //Day
            string week = Convert.ToString(table.Rows[i]["intDay"]);
            //StartNum
            //string startNum = Convert.ToString(table.Rows[i]["intStartNum"]);
            string startNum = "";
            if (Convert.ToInt16(table.Rows[i]["intStartNum"]) <= 4)
            {
                startNum = Convert.ToString(table.Rows[i]["intStartNum"]);
            }
            if ((Convert.ToInt16(table.Rows[i]["intStartNum"]) >= 5) && (Convert.ToInt16(table.Rows[i]["intStartNum"]) <= 10))
            {
                startNum = (Convert.ToInt16(table.Rows[i]["intStartNum"]) + 1).ToString();
            }
            if (Convert.ToInt16(table.Rows[i]["intStartNum"]) == 99)
            {
                startNum = "5";
            }
            //EndNum
            //string endNum = Convert.ToString(table.Rows[i]["intEndNum"]);
            string endNum = "";
            if (Convert.ToInt16(table.Rows[i]["intEndNum"]) <= 4)
            {
                endNum = Convert.ToString(table.Rows[i]["intEndNum"]);
            }
            if ((Convert.ToInt16(table.Rows[i]["intEndNum"]) >= 5) && (Convert.ToInt16(table.Rows[i]["intEndNum"]) <= 10))
            {
                endNum = (Convert.ToInt16(table.Rows[i]["intEndNum"]) + 1).ToString();
            }
            if (Convert.ToInt16(table.Rows[i]["intEndNum"]) == 99)
            {
                endNum = "5";
            }

            for (int weekCount = 1; weekCount < 8; weekCount++)                         //确定本条数据将来显示在哪一列
            {
                if (week == Convert.ToString(dtSchedule.Columns[weekCount].ColumnName)) //跟星期做比较,确定数据应该写在那一列
                {
                    tempArray[i][0] = weekCount;                                        //记录星期(确定将来的数据显示在哪一列)
                    break;
                }
            }

            for (int j = 0; j < dtSchedule.Rows.Count; j++)                //确定课程的开始时间和结束时间,并填写数据
            {
                string section  = Convert.ToString(dtSchedule.Rows[j][0]); //当前行是第几节课
                string sRoom    = Convert.ToString(table.Rows[i]["strRoomName"]);
                string sName    = Convert.ToString(table.Rows[i]["strName"]);
                string sClass   = Convert.ToString(table.Rows[i]["strClass"]);
                string sTeacher = Convert.ToString(table.Rows[i]["strTeacher"]);
                string sStartN  = Convert.ToString(table.Rows[i]["intStartNum"]);
                string sEndN    = Convert.ToString(table.Rows[i]["intEndNum"]);
                string sDay     = Convert.ToString(table.Rows[i]["intDay"]);
                string sTemp    = string.Empty;
                switch (printstr)
                {
                case "NCT": sTemp = sName + "<br />" + sClass + "<br />" + sTeacher; break;

                case "RNT": sTemp = sRoom + "<br />" + sName + "<br />" + sTeacher; break;

                case "RNC": sTemp = sRoom + "<br />" + sName + "<br />" + sClass; break;

                default: sTemp = sRoom + "-" + sName + "-" + sClass + "-" + sTeacher + "-" + sStartN + sEndN + "-星期" + sDay + "<br />"; break;
                }

                if (section == startNum) //判断课程开始时间,确定位置,填写数据
                {
                    tempArray[i][1] = j; //记录上课开始时间(确定数据显示在哪一行)
                    dtSchedule.Rows[j][tempArray[i][0]] = dtSchedule.Rows[j][tempArray[i][0]].ToString() + sTemp;
                }
                if ((Convert.ToInt16(section) > Convert.ToInt16(startNum)) && (Convert.ToInt16(section) < Convert.ToInt16(endNum)))
                {
                    dtSchedule.Rows[j][tempArray[i][0]] = dtSchedule.Rows[j][tempArray[i][0]].ToString() + sTemp;
                }
                if (section == endNum)      //判断课程结束时间,记录位置
                {
                    tempArray[i][2] = j;    //记录课结束时间
                    if (startNum != endNum) //如开始时间等于结束时间则会重复记录
                    {
                        dtSchedule.Rows[j][tempArray[i][0]] = dtSchedule.Rows[j][tempArray[i][0]].ToString() + sTemp;
                    }
                    break;
                }
            }
        }

        //修改行标题
        for (int i = 1; i < 8; i++)
        {
            dtSchedule.Columns[i].ColumnName = "星期" + CommonClass.WeekConvertToChinese(i);
        }
        //修改列标题
        //for (int i = 0; i < 10; i++)
        //{
        //    dtSchedule.Rows[i][0] = "第" + CommonClass.ConvertToChinese(i + 1) + "节";
        //}
        for (int i = 0; i < 4; i++)
        {
            dtSchedule.Rows[i][0] = "第" + ConvertToChinese2(i + 1) + "节";
        }
        dtSchedule.Rows[4][0] = "中午";
        for (int i = 5; i < 11; i++)
        {
            dtSchedule.Rows[i][0] = "第" + ConvertToChinese2(i + 1) + "节";
        }

        //dispose
        table.Dispose();
        ds.Dispose();
        sda.Dispose();
        con.Dispose();

        return(dtSchedule);
    }
Exemple #34
0
        public Main()
        {
            try
            {
                InitializeComponent();
                CheckFirebirdAndStartFirebird();
                _baseFormTitle = this.Text + Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, Assembly.GetExecutingAssembly().GetName().Version.ToString().Count() - 2); mnuOverview.Text = "Quick-Start Guide"; this.Text = _baseFormTitle;

                string sPicName = "";
                CommonClass.ActiveSetup = "USA";
                string commandText = "select SetupID,SetupName from Setups order by SetupID";
                ESIL.DBUtility.FireBirdHelperBase fb = new ESIL.DBUtility.ESILFireBirdHelper();
                System.Data.DataSet ds = fb.ExecuteDataset(CommonClass.Connection, CommandType.Text, commandText);

                string iniPath      = CommonClass.ResultFilePath + @"\BenMAP.ini";
                string defaultSetup = "United States";
                if (System.IO.File.Exists(iniPath))
                {
                    defaultSetup = CommonClass.IniReadValue("appSettings", "DefaultSetup", iniPath);
                }
                else
                {
                    CommonClass.IniWriteValue("appSettings", "IsShowStart", "T", iniPath);
                    CommonClass.IniWriteValue("appSettings", "IsShowExit", "T", iniPath);
                    CommonClass.IniWriteValue("appSettings", "DefaultSetup", "United States", iniPath);
                }
                DataRow[] drs = ds.Tables[0].Select("SetupName='" + defaultSetup + "'");
                DataRow   dr;
                if (drs != null && drs.Count() > 0)
                {
                    dr = drs[0];
                }
                else
                {
                    dr = ds.Tables[0].Rows[0];
                    CommonClass.IniWriteValue("appSettings", "DefaultSetup", dr["SetupName"].ToString(), iniPath);
                }
                BenMAPSetup benMAPSetup = new BenMAPSetup()
                {
                    SetupID   = Convert.ToInt32(dr["SetupID"]),
                    SetupName = dr["SetupName"].ToString()
                };
                mnuActiveSetup.DropDownItems.Clear();

                foreach (DataRow drSetup in ds.Tables[0].Rows)
                {
                    BenMAPSetup benMAPSetupIn = new BenMAPSetup()
                    {
                        SetupID   = Convert.ToInt32(drSetup["SetupID"]),
                        SetupName = drSetup["SetupName"].ToString()
                    };
                    ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem();
                    toolStripMenuItem.Text   = drSetup["SetupName"].ToString();
                    toolStripMenuItem.Tag    = benMAPSetupIn;
                    toolStripMenuItem.Click += new EventHandler(toolStripMenuItem_Click);
                    mnuActiveSetup.DropDownItems.Add(toolStripMenuItem);
                }
                if (mnuActiveSetup.DropDownItems.Count > 0)
                {
                    mnuActiveSetup.Text = dr["SetupName"].ToString();
                }
                CommonClass.MainSetup   = benMAPSetup;
                CommonClass.ManageSetup = benMAPSetup;

                CommonClass.lstPollutantAll = Grid.GridCommon.getAllPollutant(CommonClass.MainSetup.SetupID);
                if (CommonClass.InputParams == null || CommonClass.InputParams.Length == 0)
                {
                    StartPage startFrm = new StartPage();
                    startFrm.ShowDialog();
                }
                else if (CommonClass.InputParams[0].ToLower().Contains(".ctlx"))
                {
                    this.Hide();
                    this.ShowInTaskbar = false;
                    this.WindowState   = FormWindowState.Minimized;
                    return;
                }
                LoadForm(new BenMAP(sPicName));
                InitRecentFile();



                CommonClass.FormChangedStat -= SetCurrentStat;
                CommonClass.FormChangedStat += SetCurrentStat;

                CommonClass.FormChangedSetup -= SetCurrentSetup;
                CommonClass.FormChangedSetup += SetCurrentSetup;



                if (_currentForm != null)
                {
                    BenMAP frm = _currentForm as BenMAP;
                    if (frm != null)
                    {
                        frm.OpenFile();
                        frm.loadInputParamProject();
                    }
                    frm.mainFrm = this;
                }
                this.Status    = "Current Setup: " + CommonClass.MainSetup.SetupName;
                lblStatus.Text = this.Status;
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }